diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2014-05-07 17:09:14 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2014-05-07 17:09:14 +0200 |
commit | 3e96ec0ef9ccdf24f7ede62464f3eefed6ae624c (patch) | |
tree | 0869707eee4b3beb9041706315c754e1763fb42c /cmake | |
parent | 32ae29df83a88103f3026a97005890b2ead72b97 (diff) | |
download | mariadb-git-3e96ec0ef9ccdf24f7ede62464f3eefed6ae624c.tar.gz |
Backport from trunk:
Bug#18187290 ISSUE WITH BUILDING MYSQL USING CMAKE 2.8.12
We want to upgrade to VS2013 on Windows.
In order to do this, we need to upgrade to cmake 2.8.12
This has introduced some incompatibilities for .pdb files,
and "make install" no longer works.
To reproduce:
cmake --build . --target package --config debug
The fix:
Rather than installing .pdb files for static libraries, we use the /Z7 flag
to store symbolic debugging information in the .obj files.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/install_macros.cmake | 17 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 29 |
2 files changed, 31 insertions, 15 deletions
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 54f3225ed7e..be243a42924 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -21,26 +21,35 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets) GET_TARGET_PROPERTY(location ${target} LOCATION) GET_TARGET_PROPERTY(type ${target} TYPE) IF(NOT INSTALL_LOCATION) - IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY") + IF(type MATCHES "STATIC_LIBRARY" + OR type MATCHES "MODULE_LIBRARY" + OR type MATCHES "SHARED_LIBRARY") SET(INSTALL_LOCATION "lib") ELSEIF(type MATCHES "EXECUTABLE") SET(INSTALL_LOCATION "bin") ELSE() - MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install") + MESSAGE(FATAL_ERROR + "cannot determine type of ${target}. Don't now where to install") ENDIF() ENDIF() STRING(REPLACE ".exe" ".pdb" pdb_location ${location}) STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location}) + STRING(REPLACE + "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" + pdb_location ${pdb_location}) ENDIF() IF(target STREQUAL "mysqld") SET(comp Server) ELSE() SET(comp Debuginfo) ENDIF() - INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp}) + # No .pdb file for static libraries. + IF(NOT type MATCHES "STATIC_LIBRARY") + INSTALL(FILES ${pdb_location} + DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp}) + ENDIF() ENDFOREACH() ENDIF() ENDMACRO() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index c3809d2e6c2..54ea3cf95f9 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -62,22 +62,30 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) ENDIF() IF(MSVC) - # Enable debug info also in Release build, and create PDB to be able to analyze - # crashes - FOREACH(lang C CXX) - SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi") - ENDFOREACH() + # Enable debug info also in Release build, + # and create PDB to be able to analyze crashes. FOREACH(type EXE SHARED MODULE) - SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") + SET(CMAKE_{type}_LINKER_FLAGS_RELEASE + "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") ENDFOREACH() # Force static runtime libraries + # - Choose debugging information: + # /Z7 + # Produces an .obj file containing full symbolic debugging + # information for use with the debugger. The symbolic debugging + # information includes the names and types of variables, as well as + # functions and line numbers. No .pdb file is produced by the compiler. + FOREACH(lang C CXX) + SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") + ENDFOREACH() FOREACH(flag - CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") + STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") ENDFOREACH() # Remove support for exceptions @@ -107,7 +115,6 @@ IF(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099") - IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. # Yet, we define it here again to work around a bug with Intellisense |