mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 17:59:01 +08:00
fe112d8301
* [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
69 lines
2.4 KiB
CMake
69 lines
2.4 KiB
CMake
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO SOCI/soci
|
|
REF 334cc55d9fa7b42d7214a8533a246d637bc92899 #version 4.0.1 commit on 2020.10.19
|
|
SHA512 b300b13f68347d78252812e09efffb1735072cf5019940da53366a5cdee997f4b8b03a584a87a95ba764b0a78640ad6eb4966b53f9156280cb452465607afbc7
|
|
HEAD_REF master
|
|
PATCHES
|
|
fix-dependency-libmysql.patch
|
|
export-include-dirs.patch
|
|
)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SOCI_DYNAMIC)
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SOCI_STATIC)
|
|
|
|
# Handle features
|
|
set(_COMPONENT_FLAGS "")
|
|
foreach(_feature IN LISTS ALL_FEATURES)
|
|
# Uppercase the feature name and replace "-" with "_"
|
|
string(TOUPPER "${_feature}" _FEATURE)
|
|
string(REPLACE "-" "_" _FEATURE "${_FEATURE}")
|
|
|
|
# Turn "-DWITH_*=" ON or OFF depending on whether the feature
|
|
# is in the list.
|
|
if(_feature IN_LIST FEATURES)
|
|
list(APPEND _COMPONENT_FLAGS "-DWITH_${_FEATURE}=ON")
|
|
else()
|
|
list(APPEND _COMPONENT_FLAGS "-DWITH_${_FEATURE}=OFF")
|
|
endif()
|
|
|
|
if(_feature MATCHES "mysql")
|
|
set(MYSQL_OPT -DMYSQL_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/mysql)
|
|
endif()
|
|
endforeach()
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
-DSOCI_TESTS=OFF
|
|
-DSOCI_CXX11=ON
|
|
-DSOCI_LIBDIR:STRING=lib # This is to always have output in the lib folder and not lib64 for 64-bit builds
|
|
-DLIBDIR:STRING=lib
|
|
-DSOCI_STATIC=${SOCI_STATIC}
|
|
-DSOCI_SHARED=${SOCI_DYNAMIC}
|
|
${_COMPONENT_FLAGS}
|
|
${MYSQL_OPT}
|
|
-DWITH_ORACLE=OFF
|
|
-DWITH_FIREBIRD=OFF
|
|
-DWITH_DB2=OFF
|
|
)
|
|
|
|
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}/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)
|
|
|
|
# Handle copyright
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|