[soci] Re-fix feature mysql (#16369)

* [soci] Re-fix feature mysql

* update version record

* [soci] Fix config file name and add find_dependency

* update baseline record

* [soci] Export INTERFACE_INCLUDE_DIRECTORIES

* update version record
This commit is contained in:
Jack·Boos·Yu 2021-04-10 01:39:04 +08:00 committed by GitHub
parent 9ab06a4def
commit fe112d8301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 8 deletions

View File

@ -0,0 +1,53 @@
diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake
index 442d81d..ef56422 100644
--- a/cmake/SociBackend.cmake
+++ b/cmake/SociBackend.cmake
@@ -159,8 +159,13 @@ macro(soci_backend NAME)
${THIS_BACKEND_HEADERS})
target_link_libraries(${THIS_BACKEND_TARGET}
+ PUBLIC
${SOCI_CORE_TARGET}
${THIS_BACKEND_DEPENDS_LIBRARIES})
+
+ target_include_directories(${THIS_BACKEND_TARGET}
+ PUBLIC
+ ${THIS_BACKEND_DEPENDS_INCLUDE_DIRS})
if(WIN32)
set_target_properties(${THIS_BACKEND_TARGET}
@@ -197,8 +202,14 @@ macro(soci_backend NAME)
# Still need to link the libraries for tests to work
target_link_libraries (${THIS_BACKEND_TARGET_STATIC}
+ PUBLIC
${THIS_BACKEND_DEPENDS_LIBRARIES}
)
+
+ target_include_directories(${THIS_BACKEND_TARGET_STATIC}
+ PUBLIC
+ ${THIS_BACKEND_DEPENDS_INCLUDE_DIRS}
+ )
set_target_properties(${THIS_BACKEND_TARGET_STATIC}
PROPERTIES
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 3916cce..d537613 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -64,6 +64,7 @@ if (SOCI_SHARED)
target_include_directories(${SOCI_CORE_TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
+ $<INSTALL_INTERFACE:include>
)
endif()
@@ -96,6 +97,7 @@ if (SOCI_STATIC)
target_include_directories(${SOCI_CORE_TARGET_STATIC}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
+ $<INSTALL_INTERFACE:include>
)
endif()

View File

@ -1,12 +1,13 @@
diff --git a/cmake/modules/FindMySQL.cmake b/cmake/modules/FindMySQL.cmake
index 1233568..6110c36 100644
index 1233568..9a7cb61 100644
--- a/cmake/modules/FindMySQL.cmake
+++ b/cmake/modules/FindMySQL.cmake
@@ -13,6 +13,8 @@
@@ -13,6 +13,9 @@
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+find_package(libmysql REQUIRED)
+set(MySQL_FOUND 1)
+return()
include(CheckCXXSourceCompiles)

View File

@ -4,7 +4,9 @@ vcpkg_from_github(
REF 334cc55d9fa7b42d7214a8533a246d637bc92899 #version 4.0.1 commit on 2020.10.19
SHA512 b300b13f68347d78252812e09efffb1735072cf5019940da53366a5cdee997f4b8b03a584a87a95ba764b0a78640ad6eb4966b53f9156280cb452465607afbc7
HEAD_REF master
PATCHES fix-dependency-libmysql.patch
PATCHES
fix-dependency-libmysql.patch
export-include-dirs.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SOCI_DYNAMIC)
@ -26,7 +28,7 @@ foreach(_feature IN LISTS ALL_FEATURES)
endif()
if(_feature MATCHES "mysql")
set(MYSQL_OPT -DMYSQL_INCLUDE_DIR="${CURRENT_INSTALLED_DIR}/include/mysql")
set(MYSQL_OPT -DMYSQL_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/mysql)
endif()
endforeach()
@ -51,7 +53,14 @@ vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
# Correct the config file name
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCI.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCI-config.cmake)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCI.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCIConfig.cmake)
if ("mysql" IN_LIST FEATURES)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCIConfig.cmake
"# Create imported target SOCI::soci_mysql"
"\ninclude(CMakeFindDependencyMacro)\nfind_dependency(libmysql)\n# Create imported target SOCI::soci_mysql"
)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)

View File

@ -1,7 +1,7 @@
{
"name": "soci",
"version-string": "4.0.1",
"port-version": 2,
"version": "4.0.1",
"port-version": 3,
"description": "SOCI database access library",
"homepage": "https://github.com/SOCI/soci",
"features": {

View File

@ -5614,7 +5614,7 @@
},
"soci": {
"baseline": "4.0.1",
"port-version": 2
"port-version": 3
},
"socket-io-client": {
"baseline": "1.6.1-1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "05767aa636348d9fb5a2507a2c348091cc9d7782",
"version": "4.0.1",
"port-version": 3
},
{
"git-tree": "8127c6d88c6b673066ea41b061dd79d600c442d4",
"version-string": "4.0.1",