Skip to content

Commit 3e96ec0

Browse files
author
Tor Didriksen
committed
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.
1 parent 32ae29d commit 3e96ec0

10 files changed

Lines changed: 38 additions & 30 deletions

File tree

cmake/install_macros.cmake

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,35 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets)
2121
GET_TARGET_PROPERTY(location ${target} LOCATION)
2222
GET_TARGET_PROPERTY(type ${target} TYPE)
2323
IF(NOT INSTALL_LOCATION)
24-
IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY")
24+
IF(type MATCHES "STATIC_LIBRARY"
25+
OR type MATCHES "MODULE_LIBRARY"
26+
OR type MATCHES "SHARED_LIBRARY")
2527
SET(INSTALL_LOCATION "lib")
2628
ELSEIF(type MATCHES "EXECUTABLE")
2729
SET(INSTALL_LOCATION "bin")
2830
ELSE()
29-
MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install")
31+
MESSAGE(FATAL_ERROR
32+
"cannot determine type of ${target}. Don't now where to install")
3033
ENDIF()
3134
ENDIF()
3235
STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
3336
STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
3437
STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
3538
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
36-
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
39+
STRING(REPLACE
40+
"${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
41+
pdb_location ${pdb_location})
3742
ENDIF()
3843
IF(target STREQUAL "mysqld")
3944
SET(comp Server)
4045
ELSE()
4146
SET(comp Debuginfo)
4247
ENDIF()
43-
INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
48+
# No .pdb file for static libraries.
49+
IF(NOT type MATCHES "STATIC_LIBRARY")
50+
INSTALL(FILES ${pdb_location}
51+
DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
52+
ENDIF()
4453
ENDFOREACH()
4554
ENDIF()
4655
ENDMACRO()

cmake/os/Windows.cmake

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# 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)
6262
ENDIF()
6363

6464
IF(MSVC)
65-
# Enable debug info also in Release build, and create PDB to be able to analyze
66-
# crashes
67-
FOREACH(lang C CXX)
68-
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
69-
ENDFOREACH()
65+
# Enable debug info also in Release build,
66+
# and create PDB to be able to analyze crashes.
7067
FOREACH(type EXE SHARED MODULE)
71-
SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
68+
SET(CMAKE_{type}_LINKER_FLAGS_RELEASE
69+
"${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
7270
ENDFOREACH()
7371

7472
# Force static runtime libraries
73+
# - Choose debugging information:
74+
# /Z7
75+
# Produces an .obj file containing full symbolic debugging
76+
# information for use with the debugger. The symbolic debugging
77+
# information includes the names and types of variables, as well as
78+
# functions and line numbers. No .pdb file is produced by the compiler.
79+
FOREACH(lang C CXX)
80+
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
81+
ENDFOREACH()
7582
FOREACH(flag
76-
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
77-
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
83+
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
84+
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
7885
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
79-
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
86+
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
8087
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
88+
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
8189
ENDFOREACH()
8290

8391
# Remove support for exceptions
@@ -107,7 +115,6 @@ IF(MSVC)
107115
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
108116
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099")
109117

110-
111118
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
112119
# _WIN64 is defined by the compiler itself.
113120
# Yet, we define it here again to work around a bug with Intellisense

extra/yassl/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,6 @@ ENDIF()
3737
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
3838
RESTRICT_SYMBOL_EXPORTS(yassl)
3939

40-
INSTALL_DEBUG_SYMBOLS(yassl)
4140
IF(MSVC)
4241
INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug)
4342
ENDIF()

extra/yassl/taocrypt/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,6 @@ ENDIF()
3636
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
3737
RESTRICT_SYMBOL_EXPORTS(taocrypt)
3838

39-
INSTALL_DEBUG_SYMBOLS(taocrypt)
4039
IF(MSVC)
4140
INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug)
4241
ENDIF()

libmysql/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ ENDIF()
168168
MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development)
169169

170170
# Visual Studio users need debug static library for debug projects
171-
INSTALL_DEBUG_SYMBOLS(clientlib)
172171
IF(MSVC)
173172
INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
174173
INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug)

libmysql/authentication_win/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@ TARGET_LINK_LIBRARIES(auth_win_client Secur32)
3232

3333
SOURCE_GROUP(Headers REGULAR_EXPRESSION ".*h$")
3434

35-
INSTALL_DEBUG_SYMBOLS(auth_win_client)
3635
IF(MSVC)
3736
INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug)
3837
ENDIF()

mysys/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -78,7 +78,6 @@ ADD_EXECUTABLE(thr_lock thr_lock.c)
7878
TARGET_LINK_LIBRARIES(thr_lock mysys)
7979
SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
8080

81-
INSTALL_DEBUG_SYMBOLS(mysys)
8281
IF(MSVC)
8382
INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug)
8483
ENDIF()

strings/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@ ENDIF()
3232
ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H)
3333
ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES})
3434

35-
INSTALL_DEBUG_SYMBOLS(strings)
3635
IF(MSVC)
3736
INSTALL_DEBUG_TARGET(strings DESTINATION ${INSTALL_LIBDIR}/debug)
3837
ENDIF()

vio/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# 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)
2121
ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES})
2222
TARGET_LINK_LIBRARIES(vio ${LIBSOCKET})
2323

24-
INSTALL_DEBUG_SYMBOLS(vio)
2524
IF(MSVC)
2625
INSTALL_DEBUG_TARGET(vio DESTINATION ${INSTALL_LIBDIR}/debug)
2726
ENDIF()

zlib/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# 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.
2323
ADD_CONVENIENCE_LIBRARY(zlib ${ZLIB_SOURCES})
2424
RESTRICT_SYMBOL_EXPORTS(zlib)
2525

26-
INSTALL_DEBUG_SYMBOLS(zlib)
2726
IF(MSVC)
2827
INSTALL_DEBUG_TARGET(zlib DESTINATION ${INSTALL_LIBDIR}/debug)
2928
ENDIF()

0 commit comments

Comments
 (0)