-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-37996 CMake: INTERFACE targets for bundled-or-system libraries #5311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 10.11
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,11 @@ MACRO (MYSQL_USE_BUNDLED_SSL) | |
| CHANGE_SSL_SETTINGS("bundled") | ||
| ADD_SUBDIRECTORY(extra/wolfssl) | ||
| MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") | ||
| ADD_LIBRARY(mariadb_ssl INTERFACE) | ||
| TARGET_LINK_LIBRARIES(mariadb_ssl INTERFACE wolfssl) | ||
| TARGET_INCLUDE_DIRECTORIES(mariadb_ssl INTERFACE ${INC_DIRS}) | ||
| TARGET_COMPILE_DEFINITIONS(mariadb_ssl INTERFACE | ||
| HAVE_OPENSSL HAVE_WOLFSSL WOLFSSL_USER_SETTINGS) | ||
| ENDMACRO() | ||
|
|
||
| # MYSQL_CHECK_SSL | ||
|
|
@@ -141,11 +146,29 @@ MACRO (MYSQL_CHECK_SSL) | |
| SET(SSL_INTERNAL_INCLUDE_DIRS "") | ||
| SET(SSL_DEFINES "-DHAVE_OPENSSL") | ||
|
|
||
| ADD_LIBRARY(mariadb_ssl INTERFACE) | ||
| TARGET_LINK_LIBRARIES(mariadb_ssl INTERFACE | ||
| OpenSSL::SSL OpenSSL::Crypto) | ||
| # Put the include dir on the target itself (not only transitively via | ||
| # OpenSSL::SSL) so $<TARGET_PROPERTY:mariadb_ssl,INTERFACE_INCLUDE_DIRECTORIES> | ||
| # also works for consumers that need the openssl headers but do not link | ||
| # the library (violite.h pulls in <openssl/ssl.h> under HAVE_OPENSSL). | ||
| TARGET_INCLUDE_DIRECTORIES(mariadb_ssl INTERFACE ${OPENSSL_INCLUDE_DIR}) | ||
| IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") | ||
| TARGET_LINK_LIBRARIES(mariadb_ssl INTERFACE ${LIBSOCKET}) | ||
| ENDIF() | ||
| IF(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
| TARGET_LINK_LIBRARIES(mariadb_ssl INTERFACE ${CMAKE_DL_LIBS}) | ||
| ENDIF() | ||
| TARGET_COMPILE_DEFINITIONS(mariadb_ssl INTERFACE HAVE_OPENSSL) | ||
|
|
||
| # Silence "deprecated in OpenSSL 3.0" | ||
| IF((NOT OPENSSL_VERSION) # 3.0 not determined by older cmake | ||
| OR NOT(OPENSSL_VERSION VERSION_LESS "3.0.0")) | ||
| SET(SSL_DEFINES "${SSL_DEFINES} -DOPENSSL_API_COMPAT=0x10100000L") | ||
| SET(CMAKE_REQUIRED_DEFINITIONS -DOPENSSL_API_COMPAT=0x10100000L) | ||
| TARGET_COMPILE_DEFINITIONS(mariadb_ssl INTERFACE | ||
| OPENSSL_API_COMPAT=0x10100000L) | ||
| ENDIF() | ||
|
|
||
| SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) | ||
|
|
@@ -174,6 +197,7 @@ MACRO (MYSQL_CHECK_SSL) | |
| MESSAGE(FATAL_ERROR | ||
| "Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}") | ||
| ENDIF() | ||
| ADD_LIBRARY(MariaDB::OpenSSL ALIAS mariadb_ssl) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can't compile without SSL. |
||
| ENDMACRO() | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql | ||
| ${PCRE_INCLUDE_DIRS}) | ||
| INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) | ||
|
|
||
| MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc RECOMPILE_FOR_EMBEDDED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
${ZLIB_INCLUDE_DIRS}variable was removed from the directory-levelINCLUDE_DIRECTORIESinclient/CMakeLists.txt, but it was not replaced with$<TARGET_PROPERTY:mariadb_zlib,INTERFACE_INCLUDE_DIRECTORIES>. Since client tools (such asmysqldumpormysqlbinlog) directly or transitively includezlib.h, and they do not link directly toMariaDB::zlib(they link to${CLIENT_LIB}which islibmariadb), this will cause compilation failures when using a bundled or non-standard zlib. Please add themariadb_zlibinterface include directories here.