Skip to content

Commit ded1304

Browse files
author
Tor Didriksen
committed
WL#13318 Cleanup cmake SSL library code in 5.6 and 5.7
This patch is for 5.6 Cmake changes to support: WL#12903 BACKPORT OF WL#12361 - SUPPORT TLS 1.3 TO MYSQL 5.6 & 5.7 WL#13289 Remove yaSSL support from 5.6/5.7 codebase In several CMakeLitst.txt files: remove obsolete cmake code for copying OpenSSL .dll files on Windows. In cmake/ssl.cmake: - Add code to do version check for minor and fix version of ssl. - SSL libraries version 1.1 on windows have changed names, so extend the list of names to search for in FIND_LIBRARY(...) - Remove obsolete cmake code which tried to use openssl .dlls on windows. - Translate WITH_SSL=system on Mac and Windows to known paths (same as 8.0) This is to simplify the work for developers: no need to download tarballs from pushbuild. Note that pushbuild will continue to use WITH_SSL=<path/to/custom/openssl> In libmysql/CMakeLists.txt separate the LIBS macro into LIBS_TO_MERGE and LIBS_TO_LINK, otherwise the code in MERGE_CONVENIENCE_LIBRARIES may fail in mysterious ways. This is a backport from 8.0 Same patch as for 5.7 plus: - disable -Wclass-memaccess warnings for modern C++ compilers. - explicitly set -std=gnu++03 in order to be able to build with modern C++ compilers Changes from the 5.7 patch *not* included - 5.6 has no protobuf code - ndbcluster does not build in 5.6 so cmake changes not backported The current patch keeps "bundled" i.e. YaSSL as default. This will be removed by WL#13289. Change-Id: Id546350978fe579b77b144dfda2f4635c0600852
1 parent 680ff0b commit ded1304

File tree

9 files changed

+199
-122
lines changed

9 files changed

+199
-122
lines changed

CMakeLists.txt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2019, 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
@@ -40,6 +40,19 @@ IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
4040
CMAKE_POLICY(SET CMP0042 OLD)
4141
ENDIF()
4242

43+
# In CMake 3.12 and above, the
44+
#
45+
# * ``check_include_file`` macro in the ``CheckIncludeFile`` module, the
46+
# * ``check_include_file_cxx`` macro in the
47+
# ``CheckIncludeFileCXX`` module, and the
48+
# * ``check_include_files`` macro in the ``CheckIncludeFiles`` module
49+
#
50+
# now prefer to link the check executable to the libraries listed in the
51+
# ``CMAKE_REQUIRED_LIBRARIES`` variable.
52+
IF(POLICY CMP0075)
53+
CMAKE_POLICY(SET CMP0075 OLD)
54+
ENDIF()
55+
4356
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
4457

4558
# Will set GIT_EXECUTABLE and GIT_FOUND
@@ -113,6 +126,16 @@ ELSE()
113126
${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
114127
MARK_AS_ADVANCED(MYSQL_PROJECT_NAME)
115128
ENDIF()
129+
130+
# STRING(APPEND ...) from cmake VERSION 3.4
131+
MACRO(STRING_APPEND STRING_VAR INPUT)
132+
SET(${STRING_VAR} "${${STRING_VAR}}${INPUT}")
133+
ENDMACRO()
134+
135+
MACRO(STRING_PREPEND STRING_VAR INPUT)
136+
SET(${STRING_VAR} "${INPUT}${${STRING_VAR}}")
137+
ENDMACRO()
138+
116139
PROJECT(${MYSQL_PROJECT_NAME})
117140

118141
# Maintainer mode is default on only for Linux debug builds using GCC/G++
@@ -479,6 +502,12 @@ IF(WITH_SYMVER16)
479502
ADD_DEFINITIONS(-DEXPORT_SYMVER16)
480503
ENDIF()
481504

505+
# Disable -Werror=class-memaccess for gcc >= 8
506+
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT GXX_VERSION VERSION_LESS 8)
507+
STRING_APPEND(CMAKE_CXX_FLAGS_DEBUG " -Wno-class-memaccess")
508+
STRING_APPEND(CMAKE_CXX_FLAGS_RELWITHDEBINFO " -Wno-class-memaccess")
509+
ENDIF()
510+
482511
IF(NOT WITHOUT_SERVER)
483512
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
484513
# Add storage engines and plugins.

client/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2019, 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
@@ -26,9 +26,6 @@ INCLUDE_DIRECTORIES(
2626
)
2727

2828

29-
## We will need libeay32.dll and ssleay32.dll when running client executables.
30-
COPY_OPENSSL_DLLS(copy_openssl_client)
31-
3229
ADD_DEFINITIONS(${SSL_DEFINES})
3330
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
3431
TARGET_LINK_LIBRARIES(mysql mysqlclient)

cmake/build_configurations/compiler_options.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2012, 2019, 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
@@ -34,6 +34,12 @@ IF(UNIX)
3434
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
3535
ENDIF()
3636
IF(CMAKE_COMPILER_IS_GNUCXX)
37+
# GCC 6 has C++14 as default, set it explicitly to the old default.
38+
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
39+
OUTPUT_VARIABLE GXX_VERSION)
40+
IF(GXX_VERSION VERSION_EQUAL 6.0 OR GXX_VERSION VERSION_GREATER 6.0)
41+
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -std=gnu++03")
42+
ENDIF()
3743
SET(COMMON_CXX_FLAGS "-g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing")
3844
# Disable inline optimizations for valgrind testing to avoid false positives
3945
IF(WITH_VALGRIND)
@@ -51,6 +57,12 @@ IF(UNIX)
5157
ENDIF()
5258
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5359
SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing")
60+
IF(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.0 OR
61+
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
62+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
63+
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -std=gnu++03")
64+
ENDIF()
65+
ENDIF()
5466
SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
5567
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
5668
ENDIF()

cmake/build_configurations/feature_set.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2012, 2019, 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
@@ -77,5 +77,9 @@ IF(FEATURE_SET)
7777
ENDFOREACH()
7878
ENDIF()
7979

80-
SET(WITH_SSL bundled CACHE STRING "")
81-
SET(WITH_ZLIB bundled CACHE STRING "")
80+
IF(NOT WITH_SSL)
81+
SET(WITH_SSL bundled CACHE STRING "")
82+
ENDIF()
83+
IF(NOT WITH_ZLIB)
84+
SET(WITH_ZLIB bundled CACHE STRING "")
85+
ENDIF()

0 commit comments

Comments
 (0)