-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libmariadb] Update, major refresh (#41175)
- Loading branch information
Showing
20 changed files
with
316 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt | ||
index bbad89a..71662d3 100644 | ||
--- a/libmariadb/CMakeLists.txt | ||
+++ b/libmariadb/CMakeLists.txt | ||
@@ -547,3 +547,22 @@ IF(0) | ||
CONFIGURATIONS Debug RelWithDebInfo | ||
COMPONENT Development) | ||
ENDIF() | ||
+ | ||
+set_target_properties(mariadbclient PROPERTIES EXPORT_NAME libmariadb) | ||
+ | ||
+install(EXPORT unofficial-libmariadb-targets | ||
+ NAMESPACE unofficial:: | ||
+ DESTINATION share/unofficial-libmariadb | ||
+) | ||
+ | ||
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake.in" [[ | ||
+if(NOT "@BUILD_SHARED_LIBS@") | ||
+ include(CMakeFindDependencyMacro) | ||
+ if("@WITH_ZSTD@") | ||
+ find_dependency(zstd CONFIG) | ||
+ endif() | ||
+endif() | ||
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-libmariadb-targets.cmake") | ||
+]]) | ||
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake" @ONLY) | ||
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake" DESTINATION share/unofficial-libmariadb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 8994119..9ccfacb 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -113,8 +113,6 @@ IF(MSVC) | ||
ENDIF() | ||
ENDIF() | ||
STRING(REPLACE "/Zi" "/Z7" COMPILER_FLAGS ${COMPILER_FLAGS}) | ||
- MESSAGE (STATUS "CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE}= ${COMPILER_FLAGS}") | ||
- SET(CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE} ${COMPILER_FLAGS}) | ||
ENDIF() | ||
ENDFOREACH() | ||
ENDFOREACH() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 9ccfacb..4e28b38 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -219,7 +219,12 @@ INCLUDE(${CC_SOURCE_DIR}/cmake/SearchLibrary.cmake) | ||
|
||
# Compression plugins: ZSTD, ZLIB | ||
|
||
-INCLUDE(${CC_SOURCE_DIR}/cmake/FindZStd.cmake) | ||
+if(WITH_ZSTD) | ||
+ find_package(ZSTD NAMES zstd REQUIRED) | ||
+ set(ZSTD_LIBRARIES zstd::libzstd) | ||
+else() | ||
+ set(ZSTD_FOUND 0) | ||
+endif() | ||
|
||
IF(WITH_EXTERNAL_ZLIB) | ||
IF(NOT ZLIB_FOUND) | ||
@@ -250,7 +255,7 @@ IF(UNIX) | ||
SEARCH_LIBRARY(LIBNSL gethostbyname_r "nsl_r;nsl") | ||
SEARCH_LIBRARY(LIBSOCKET setsockopt socket) | ||
FIND_PACKAGE(Threads) | ||
- SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${ZLIB_LIBRARY} | ||
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${ZLIB_LIBRARIES} | ||
${LIBSOCKET} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD}) | ||
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBNSL} ${LIBBIND} ${LIBICONV} | ||
${LIBSOCKET} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD}) | ||
@@ -307,7 +312,7 @@ IF(NOT WITH_SSL STREQUAL "OFF") | ||
ADD_DEFINITIONS(-DHAVE_OPENSSL -DHAVE_TLS) | ||
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/openssl.c" | ||
"${CC_SOURCE_DIR}/libmariadb/secure/openssl_crypt.c") | ||
- SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) | ||
+ SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES}) | ||
IF(WIN32 AND EXISTS ${OPENSSL_INCLUDE_DIR}/openssl/applink.c) | ||
SET(HAVE_OPENSSL_APPLINK_C 1) | ||
ENDIF() | ||
@@ -371,7 +376,12 @@ ENDIF() | ||
|
||
IF(WITH_ICONV) | ||
IF(NOT WIN32) | ||
- INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake) | ||
+ find_package(Iconv REQUIRED) | ||
+ include_directories(${Iconv_INCLUDE_DIRS}) | ||
+ set(ICONV_LIBRARIES "${Iconv_LIBRARIES}") | ||
+ if(NOT Iconv_IS_BUILT_IN) | ||
+ set(ICONV_EXTERNAL 1) | ||
+ endif() | ||
ENDIF() | ||
ENDIF() | ||
|
||
@@ -431,7 +441,7 @@ ENDIF() | ||
INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt) | ||
ADD_SUBDIRECTORY(include) | ||
ADD_SUBDIRECTORY(libmariadb) | ||
-IF((NOT WIN32) OR CYGWIN) | ||
+IF(1) | ||
ADD_SUBDIRECTORY(mariadb_config) | ||
ENDIF() | ||
|
||
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt | ||
index 852be8d..61ad0a6 100644 | ||
--- a/libmariadb/CMakeLists.txt | ||
+++ b/libmariadb/CMakeLists.txt | ||
@@ -293,7 +293,7 @@ SET(MARIADB_NONBLOCK_SYMBOLS | ||
|
||
# handle static plugins | ||
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} ${LIBMARIADB_PLUGIN_SOURCES}) | ||
-SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARY} ${ZLIB_LIBRARY}) | ||
+SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARIES} ${ZLIB_LIBRARIES}) | ||
MESSAGE(STATUS "SYSTEM_LIBS: ${SYSTEM_LIBS}") | ||
INCLUDE_DIRECTORIES(${LIBMARIADB_PLUGIN_INCLUDES}) | ||
ADD_DEFINITIONS(${LIBMARIADB_PLUGIN_DEFS}) | ||
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt | ||
index 4cb0ba9..c15838a 100644 | ||
--- a/mariadb_config/CMakeLists.txt | ||
+++ b/mariadb_config/CMakeLists.txt | ||
@@ -30,6 +30,22 @@ IF(${rllength} GREATER 0) | ||
LIST(REMOVE_DUPLICATES SYSTEM_LIBS) | ||
ENDIF() | ||
|
||
+set(REQUIRES_PRIVATE "" CACHE STRING "") | ||
+list(REMOVE_ITEM SYSTEM_LIBS ${ZLIB_LIBRARIES}) | ||
+string(APPEND REQUIRES_PRIVATE " zlib") | ||
+if(LIBM) | ||
+ list(REMOVE_ITEM SYSTEM_LIBS ${LIBM}) | ||
+ list(APPEND SYSTEM_LIBS "m") | ||
+endif() | ||
+if(WITH_SSL STREQUAL "OPENSSL") | ||
+ list(REMOVE_ITEM SYSTEM_LIBS ${SSL_LIBRARIES}) | ||
+ string(APPEND REQUIRES_PRIVATE " openssl") | ||
+endif() | ||
+if(WITH_ZSTD) | ||
+ list(REMOVE_ITEM SYSTEM_LIBS ${ZSTD_LIBRARIES}) | ||
+ string(APPEND REQUIRES_PRIVATE " libzstd") | ||
+endif() | ||
+ | ||
FOREACH (LIB_NAME ${SYSTEM_LIBS}) | ||
GET_LIB_NAME(${LIB_NAME} LIB_OUT) | ||
SET(extra_dynamic_LDFLAGS "${extra_dynamic_LDFLAGS} ${LIB_OUT}") | ||
diff --git a/mariadb_config/libmariadb.pc.in b/mariadb_config/libmariadb.pc.in | ||
index 968181a..3f0410d 100644 | ||
--- a/mariadb_config/libmariadb.pc.in | ||
+++ b/mariadb_config/libmariadb.pc.in | ||
@@ -16,5 +16,6 @@ Description: MariaDB Connector/C dynamic library | ||
Cflags: -I${includedir} | ||
Libs: -L${libdir} -lmariadb | ||
Libs.private: @extra_dynamic_LDFLAGS@ | ||
+Requires.private: @REQUIRES_PRIVATE@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt | ||
index 0a32343..4cb0ba9 100644 | ||
--- a/mariadb_config/CMakeLists.txt | ||
+++ b/mariadb_config/CMakeLists.txt | ||
@@ -58,9 +58,7 @@ ENDIF() | ||
|
||
# Installation | ||
# | ||
-INSTALL(TARGETS mariadb_config | ||
- DESTINATION "${INSTALL_BINDIR}" | ||
- COMPONENT Development) | ||
+set_target_properties(mariadb_config PROPERTIES EXCLUDE_FROM_ALL 1) # not portable | ||
|
||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmariadb.pc | ||
DESTINATION "${INSTALL_PCDIR}" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt | ||
index 61ad0a6..bbad89a 100644 | ||
--- a/libmariadb/CMakeLists.txt | ||
+++ b/libmariadb/CMakeLists.txt | ||
@@ -494,7 +494,9 @@ IF(WITH_MYSQLCOMPAT) | ||
ENDIF() | ||
ENDIF() | ||
|
||
+if(NOT BUILD_SHARED_LIBS) | ||
create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR}) | ||
+endif() | ||
|
||
SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION | ||
${CPACK_PACKAGE_VERSION_MAJOR} | ||
@@ -502,27 +504,44 @@ SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION | ||
|
||
IF(NOT WIN32) | ||
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}") | ||
+elseif(MINGW) | ||
+ set_target_properties(libmariadb PROPERTIES IMPORT_PREFIX "") | ||
ENDIF() | ||
|
||
+if(NOT BUILD_SHARED_LIBS) | ||
+set_target_properties(libmariadb PROPERTIES EXCLUDE_FROM_ALL 1) | ||
+target_include_directories(mariadbclient PUBLIC $<INSTALL_INTERFACE:include/mysql>) | ||
INSTALL(TARGETS mariadbclient | ||
+ EXPORT unofficial-libmariadb-targets | ||
COMPONENT Development | ||
+ ARCHIVE | ||
DESTINATION ${INSTALL_LIBDIR}) | ||
+else() | ||
+set_target_properties(mariadbclient PROPERTIES EXCLUDE_FROM_ALL 1) | ||
+target_include_directories(libmariadb PUBLIC $<INSTALL_INTERFACE:include/mysql>) | ||
IF(WIN32) | ||
INSTALL(TARGETS libmariadb | ||
+ EXPORT unofficial-libmariadb-targets | ||
COMPONENT SharedLibraries | ||
+ RUNTIME DESTINATION ${INSTALL_BINDIR} | ||
+ LIBRARY DESTINATION ${INSTALL_LIBDIR} | ||
+ ARCHIVE | ||
DESTINATION ${INSTALL_LIBDIR}) | ||
ELSE() | ||
# in cmake 3.12+ we can use | ||
#INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} | ||
# COMPONENT SharedLibraries NAMELINK_COMPONENT Development) | ||
# but as long as we build on CentOS 7 with its cmake 2.8.12.2 we have to use | ||
-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} | ||
+INSTALL(TARGETS libmariadb | ||
+ EXPORT unofficial-libmariadb-targets | ||
+ LIBRARY DESTINATION ${INSTALL_LIBDIR} | ||
COMPONENT SharedLibraries NAMELINK_SKIP) | ||
INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} | ||
COMPONENT Development NAMELINK_ONLY) | ||
ENDIF() | ||
+endif() | ||
|
||
-IF(MSVC) | ||
+IF(0) | ||
# On Windows, install PDB | ||
INSTALL(FILES $<TARGET_PDB_FILE:libmariadb> DESTINATION "${INSTALL_LIBDIR}" | ||
CONFIGURATIONS Debug RelWithDebInfo |
Oops, something went wrong.