vcpkg/ports/soci/portfile.cmake

60 lines
2.0 KiB
CMake
Raw Normal View History

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO SOCI/soci
2020-11-21 03:54:07 +08:00
REF 334cc55d9fa7b42d7214a8533a246d637bc92899 #version 4.0.1 commit on 2020.10.19
SHA512 b300b13f68347d78252812e09efffb1735072cf5019940da53366a5cdee997f4b8b03a584a87a95ba764b0a78640ad6eb4966b53f9156280cb452465607afbc7
HEAD_REF master
PATCHES fix-dependency-libmysql.patch
2016-11-18 11:53:37 +08:00
)
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()
2016-11-18 11:53:37 +08:00
vcpkg_configure_cmake(
2019-04-09 14:54:58 +08:00
SOURCE_PATH ${SOURCE_PATH}
2018-05-20 09:08:17 +08:00
PREFER_NINJA
2016-11-18 11:53:37 +08:00
OPTIONS
-DSOCI_TESTS=OFF
-DSOCI_CXX11=ON
2018-05-20 09:08:17 +08:00
-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
2016-11-18 11:53:37 +08:00
)
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)
2016-11-18 11:53:37 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
2016-11-18 11:53:37 +08:00
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)