mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-14 04:19:08 +08:00
774469f31a
* [libmysql] update to 8.0.32 * update version * minimize system libs patch * update version * fix compilation on macOS with homebrew * update version * fix `\n` by mistake * fix mysql_config * update version
143 lines
4.9 KiB
Diff
143 lines
4.9 KiB
Diff
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
|
|
index 870c9f13732..98bc3ea15e4 100644
|
|
--- a/cmake/install_macros.cmake
|
|
+++ b/cmake/install_macros.cmake
|
|
@@ -97,7 +97,7 @@ ENDFUNCTION()
|
|
FUNCTION(MYSQL_INSTALL_TARGET target_arg)
|
|
CMAKE_PARSE_ARGUMENTS(ARG
|
|
"NAMELINK_SKIP"
|
|
- "DESTINATION;COMPONENT"
|
|
+ "DESTINATION;COMPONENT;EXPORT"
|
|
""
|
|
${ARGN}
|
|
)
|
|
@@ -113,10 +113,21 @@ FUNCTION(MYSQL_INSTALL_TARGET target_arg)
|
|
IF(ARG_NAMELINK_SKIP)
|
|
SET(LIBRARY_INSTALL_ARGS NAMELINK_SKIP)
|
|
ENDIF()
|
|
- INSTALL(TARGETS ${target}
|
|
- RUNTIME DESTINATION ${ARG_DESTINATION} ${COMP}
|
|
- ARCHIVE DESTINATION ${ARG_DESTINATION} ${COMP}
|
|
- LIBRARY DESTINATION ${ARG_DESTINATION} ${COMP} ${LIBRARY_INSTALL_ARGS})
|
|
+ IF (ARG_EXPORT)
|
|
+ FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${ARG_EXPORT}-config.cmake"
|
|
+"include(CMakeFindDependencyMacro)
|
|
+find_dependency(ZLIB)
|
|
+find_dependency(OpenSSL)
|
|
+find_dependency(Threads)
|
|
+include(\"\${CMAKE_CURRENT_LIST_DIR}/${ARG_EXPORT}-targets.cmake\")
|
|
+")
|
|
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ARG_EXPORT}-config.cmake DESTINATION share/${ARG_EXPORT})
|
|
+ set(EXPORT_ARGS EXPORT ${ARG_EXPORT}-targets)
|
|
+ ENDIF()
|
|
+ INSTALL(TARGETS ${target} ${EXPORT_ARGS} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ${COMP})
|
|
+ IF (ARG_EXPORT)
|
|
+ INSTALL(${EXPORT_ARGS} DESTINATION share/${ARG_EXPORT})
|
|
+ ENDIF()
|
|
SET(INSTALL_LOCATION ${ARG_DESTINATION} )
|
|
INSTALL_DEBUG_SYMBOLS(${target})
|
|
SET(INSTALL_LOCATION)
|
|
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
|
|
index ae13a63dfdc..ee9462c4c90 100644
|
|
--- a/cmake/libutils.cmake
|
|
+++ b/cmake/libutils.cmake
|
|
@@ -297,8 +297,7 @@ MACRO(MERGE_LIBRARIES_SHARED TARGET_ARG)
|
|
IF(ARG_NAMELINK_SKIP)
|
|
SET(INSTALL_ARGS NAMELINK_SKIP)
|
|
ENDIF()
|
|
- MYSQL_INSTALL_TARGET(${TARGET} DESTINATION "${DESTINATION}" ${COMP}
|
|
- ${INSTALL_ARGS})
|
|
+ MYSQL_INSTALL_TARGET(${TARGET} EXPORT unofficial-libmysql DESTINATION "${INSTALL_LIBDIR}" ${COMP})
|
|
ENDIF()
|
|
|
|
IF(WIN32)
|
|
@@ -545,8 +544,7 @@ FUNCTION(ADD_SHARED_LIBRARY TARGET_ARG)
|
|
ELSE()
|
|
SET(COMP COMPONENT SharedLibraries)
|
|
ENDIF()
|
|
- MYSQL_INSTALL_TARGET(
|
|
- ${TARGET} DESTINATION "${DESTINATION}" ${COMP})
|
|
+ MYSQL_INSTALL_TARGET(${TARGET} EXPORT unofficial-libmysql DESTINATION "${INSTALL_LIBDIR}" ${COMP})
|
|
ENDIF()
|
|
|
|
IF(ARG_COMPILE_DEFINITIONS)
|
|
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
|
|
index 2ee26bfa284..46583f4f0a3 100644
|
|
--- a/libmysql/CMakeLists.txt
|
|
+++ b/libmysql/CMakeLists.txt
|
|
@@ -277,6 +277,14 @@ ENDIF()
|
|
# LDAP authentication SASL client plug-in
|
|
ADD_SUBDIRECTORY(authentication_ldap)
|
|
|
|
+IF (BUILD_SHARED_LIBS)
|
|
+ set(INSTALL_SHARED )
|
|
+ set(INSTALL_STATIC SKIP_INSTALL)
|
|
+ELSE()
|
|
+ set(INSTALL_SHARED SKIP_INSTALL)
|
|
+ set(INSTALL_STATIC )
|
|
+ENDIF()
|
|
+
|
|
# FIDO authentication client plugin
|
|
ADD_SUBDIRECTORY(authentication_fido)
|
|
|
|
@@ -287,7 +295,7 @@ ADD_SUBDIRECTORY(authentication_kerberos)
|
|
ADD_SUBDIRECTORY(authentication_oci_client)
|
|
|
|
# Merge several convenience libraries into one big mysqlclient
|
|
-MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE}
|
|
+MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE} ${INSTALL_STATIC}
|
|
COMPONENT Development
|
|
LINK_LIBRARIES ${LIBS_TO_LINK}
|
|
)
|
|
@@ -403,6 +403,7 @@ CONFIGURE_FILE(api_test.c.in ${CMAKE_CURRENT_BINARY_DIR}/api_test.c)
|
|
# from @CLIENT_API_FUNCTIONS@ are declared by <mysql.h>. It will fail
|
|
# to run if not all of these symbols are exported by the library.
|
|
#
|
|
+IF (ENABLE_TESTING)
|
|
MYSQL_ADD_EXECUTABLE(libmysql_api_test
|
|
${CMAKE_CURRENT_BINARY_DIR}/api_test.c
|
|
LINK_LIBRARIES libmysql ${LIBRT}
|
|
@@ -410,6 +411,7 @@ MYSQL_ADD_EXECUTABLE(libmysql_api_test
|
|
)
|
|
# Clang/UBSAN needs this on some platforms.
|
|
SET_TARGET_PROPERTIES(libmysql_api_test PROPERTIES LINKER_LANGUAGE CXX)
|
|
+ENDIF()
|
|
|
|
IF(MY_COMPILER_IS_GNU)
|
|
ADD_COMPILE_FLAGS(
|
|
@@ -426,9 +428,11 @@ IF(HAS_WARN_FLAG)
|
|
)
|
|
ENDIF()
|
|
|
|
+IF (ENABLE_TESTING)
|
|
# Verify that libmysql_api_test runs OK
|
|
MY_ADD_CUSTOM_TARGET(run_libmysql_api_test ALL
|
|
DEPENDS libmysql_api_test
|
|
COMMAND libmysql_api_test
|
|
> ${CMAKE_CURRENT_BINARY_DIR}/libmysql_api_test.out
|
|
)
|
|
+ENDIF()
|
|
\ No newline at end of file
|
|
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
|
|
index a5fa18e..0f2e15c 100644
|
|
--- a/scripts/CMakeLists.txt
|
|
+++ b/scripts/CMakeLists.txt
|
|
@@ -329,13 +329,13 @@ MACRO(EXTRACT_LINK_LIBRARIES target var)
|
|
STRING(REGEX REPLACE "^[ ]+" "" ${var} "${${var}}")
|
|
STRING(REGEX REPLACE "[ ]+$" "" ${var} "${${var}}")
|
|
ENDMACRO()
|
|
-
|
|
+IF (NOT BUILD_SHARED_LIBS)
|
|
EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)
|
|
-
|
|
-IF(MSVC)
|
|
+ENDIF()
|
|
+IF(MSVC AND NOT BUILD_SHARED_LIBS)
|
|
GET_TARGET_PROPERTY(LIBMYSQL_OS_SHLIB_VERSION mysqlclient VERSION)
|
|
GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME mysqlclient OUTPUT_NAME)
|
|
-ELSE()
|
|
+ELSEIF(BUILD_SHARED_LIBS)
|
|
GET_TARGET_PROPERTY(LIBMYSQL_OS_SHLIB_VERSION libmysql VERSION)
|
|
GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME libmysql OUTPUT_NAME)
|
|
ENDIF()
|