Commit 918837f7 authored by Tor Didriksen's avatar Tor Didriksen

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.
parent e1da25f6
...@@ -21,26 +21,35 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets) ...@@ -21,26 +21,35 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets)
GET_TARGET_PROPERTY(location ${target} LOCATION) GET_TARGET_PROPERTY(location ${target} LOCATION)
GET_TARGET_PROPERTY(type ${target} TYPE) GET_TARGET_PROPERTY(type ${target} TYPE)
IF(NOT INSTALL_LOCATION) 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") SET(INSTALL_LOCATION "lib")
ELSEIF(type MATCHES "EXECUTABLE") ELSEIF(type MATCHES "EXECUTABLE")
SET(INSTALL_LOCATION "bin") SET(INSTALL_LOCATION "bin")
ELSE() 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()
ENDIF() ENDIF()
STRING(REPLACE ".exe" ".pdb" pdb_location ${location}) STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
IF(CMAKE_GENERATOR MATCHES "Visual Studio") 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() ENDIF()
IF(target STREQUAL "mysqld") IF(target STREQUAL "mysqld")
SET(comp Server) SET(comp Server)
ELSE() ELSE()
SET(comp Debuginfo) SET(comp Debuginfo)
ENDIF() 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() ENDFOREACH()
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
......
# 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 # 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 # 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) ...@@ -62,22 +62,30 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
# Enable debug info also in Release build, and create PDB to be able to analyze # Enable debug info also in Release build,
# crashes # and create PDB to be able to analyze crashes.
FOREACH(lang C CXX)
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
ENDFOREACH()
FOREACH(type EXE SHARED MODULE) 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() ENDFOREACH()
# Force static runtime libraries # 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 FOREACH(flag
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO 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 "/MD" "/MT" "${flag}" "${${flag}}")
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
ENDFOREACH() ENDFOREACH()
# Remove support for exceptions # Remove support for exceptions
...@@ -107,7 +115,6 @@ IF(MSVC) ...@@ -107,7 +115,6 @@ IF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8) IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself. # _WIN64 is defined by the compiler itself.
# Yet, we define it here again to work around a bug with Intellisense # Yet, we define it here again to work around a bug with Intellisense
......
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -37,7 +37,6 @@ ENDIF() ...@@ -37,7 +37,6 @@ ENDIF()
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
RESTRICT_SYMBOL_EXPORTS(yassl) RESTRICT_SYMBOL_EXPORTS(yassl)
INSTALL_DEBUG_SYMBOLS(yassl)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
......
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -36,7 +36,6 @@ ENDIF() ...@@ -36,7 +36,6 @@ ENDIF()
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
RESTRICT_SYMBOL_EXPORTS(taocrypt) RESTRICT_SYMBOL_EXPORTS(taocrypt)
INSTALL_DEBUG_SYMBOLS(taocrypt)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
......
...@@ -168,7 +168,6 @@ ENDIF() ...@@ -168,7 +168,6 @@ ENDIF()
MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development) MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development)
# Visual Studio users need debug static library for debug projects # Visual Studio users need debug static library for debug projects
INSTALL_DEBUG_SYMBOLS(clientlib)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug)
......
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -32,7 +32,6 @@ TARGET_LINK_LIBRARIES(auth_win_client Secur32) ...@@ -32,7 +32,6 @@ TARGET_LINK_LIBRARIES(auth_win_client Secur32)
SOURCE_GROUP(Headers REGULAR_EXPRESSION ".*h$") SOURCE_GROUP(Headers REGULAR_EXPRESSION ".*h$")
INSTALL_DEBUG_SYMBOLS(auth_win_client)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -78,7 +78,6 @@ ADD_EXECUTABLE(thr_lock thr_lock.c) ...@@ -78,7 +78,6 @@ ADD_EXECUTABLE(thr_lock thr_lock.c)
TARGET_LINK_LIBRARIES(thr_lock mysys) TARGET_LINK_LIBRARIES(thr_lock mysys)
SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN") SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
INSTALL_DEBUG_SYMBOLS(mysys)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -32,7 +32,6 @@ ENDIF() ...@@ -32,7 +32,6 @@ ENDIF()
ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H) ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H)
ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES}) ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES})
INSTALL_DEBUG_SYMBOLS(strings)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(strings DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(strings DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -21,7 +21,6 @@ SET(VIO_SOURCES vio.c viosocket.c viossl.c viosslfactories.c) ...@@ -21,7 +21,6 @@ SET(VIO_SOURCES vio.c viosocket.c viossl.c viosslfactories.c)
ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES}) ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES})
TARGET_LINK_LIBRARIES(vio ${LIBSOCKET}) TARGET_LINK_LIBRARIES(vio ${LIBSOCKET})
INSTALL_DEBUG_SYMBOLS(vio)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(vio DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(vio DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -23,7 +23,6 @@ SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio. ...@@ -23,7 +23,6 @@ SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.
ADD_CONVENIENCE_LIBRARY(zlib ${ZLIB_SOURCES}) ADD_CONVENIENCE_LIBRARY(zlib ${ZLIB_SOURCES})
RESTRICT_SYMBOL_EXPORTS(zlib) RESTRICT_SYMBOL_EXPORTS(zlib)
INSTALL_DEBUG_SYMBOLS(zlib)
IF(MSVC) IF(MSVC)
INSTALL_DEBUG_TARGET(zlib DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(zlib DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF() ENDIF()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment