Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit ee83c5a

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 adf46af commit ee83c5a

File tree

11 files changed

+48
-39
lines changed

11 files changed

+48
-39
lines changed

cmake/install_macros.cmake

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 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,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

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2012, 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
@@ -63,28 +63,37 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
6363
ENDIF()
6464

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

75-
# Force static runtime libraries
76-
# Choose C++ exception handling:
77-
# If /EH is not specified, the compiler will catch structured and
78-
# C++ exceptions, but will not destroy C++ objects that will go out of
79-
# scope as a result of the exception.
80-
# /EHsc catches C++ exceptions only and tells the compiler to assume that
81-
# extern C functions never throw a C++ exception.
73+
# For release types Debug Release RelWithDebInfo (but not MinSizeRel):
74+
# - Force static runtime libraries
75+
# - Choose C++ exception handling:
76+
# If /EH is not specified, the compiler will catch structured and
77+
# C++ exceptions, but will not destroy C++ objects that will go out of
78+
# scope as a result of the exception.
79+
# /EHsc catches C++ exceptions only and tells the compiler to assume that
80+
# extern C functions never throw a C++ exception.
81+
# - Choose debugging information:
82+
# /Z7
83+
# Produces an .obj file containing full symbolic debugging
84+
# information for use with the debugger. The symbolic debugging
85+
# information includes the names and types of variables, as well as
86+
# functions and line numbers. No .pdb file is produced by the compiler.
87+
FOREACH(lang C CXX)
88+
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
89+
ENDFOREACH()
8290
FOREACH(flag
83-
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
84-
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
91+
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
92+
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
8593
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
86-
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
94+
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
8795
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
96+
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
8897
SET("${flag}" "${${flag}} /EHsc")
8998
ENDFOREACH()
9099

extra/yassl/CMakeLists.txt

+1-2
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
@@ -33,7 +33,6 @@ SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp sr
3333
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
3434
RESTRICT_SYMBOL_EXPORTS(yassl)
3535

36-
INSTALL_DEBUG_SYMBOLS(yassl)
3736
IF(MSVC)
3837
INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug)
3938
ENDIF()

extra/yassl/taocrypt/CMakeLists.txt

+1-2
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

+1-2
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
@@ -183,7 +183,6 @@ ENDIF()
183183
MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development)
184184

185185
# Visual Studio users need debug static library for debug projects
186-
INSTALL_DEBUG_SYMBOLS(clientlib)
187186
IF(MSVC)
188187
INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
189188
INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug)

libmysql/authentication_win/CMakeLists.txt

+1-2
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

+1-2
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
@@ -76,7 +76,6 @@ TARGET_LINK_LIBRARIES(queues mysys)
7676
SET_TARGET_PROPERTIES(queues PROPERTIES COMPILE_FLAGS "-DMAIN")
7777
ADD_TEST(queues_test queues)
7878

79-
INSTALL_DEBUG_SYMBOLS(mysys)
8079
IF(MSVC)
8180
INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug)
8281
ENDIF()

mysys_ssl/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ ADD_CONVENIENCE_LIBRARY(mysys_ssl ${MYSYS_SSL_SOURCES})
6262
TARGET_LINK_LIBRARIES(mysys_ssl dbug strings ${SSL_LIBRARIES} ${ZLIB_LIBRARY})
6363
DTRACE_INSTRUMENT(mysys_ssl)
6464

65-
INSTALL_DEBUG_SYMBOLS(mysys_ssl)
6665
IF(MSVC)
6766
INSTALL_DEBUG_TARGET(mysys_ssl DESTINATION ${INSTALL_LIBDIR}/debug)
6867
ENDIF()

strings/CMakeLists.txt

+1-2
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
@@ -35,7 +35,6 @@ ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES})
3535
ADD_EXECUTABLE(conf_to_src EXCLUDE_FROM_ALL conf_to_src.c)
3636
TARGET_LINK_LIBRARIES(conf_to_src strings)
3737

38-
INSTALL_DEBUG_SYMBOLS(strings)
3938
IF(MSVC)
4039
INSTALL_DEBUG_TARGET(strings DESTINATION ${INSTALL_LIBDIR}/debug)
4140
ENDIF()

vio/CMakeLists.txt

+1-2
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 viopipe.c vioshm.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

+1-2
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)