vcpkg/ports/soci/portfile.cmake
emexal-company 9d1ffee0e1
[SOCI] Add support for soci-mysql connector (#15577)
* Add support for soci-mysql connector

* Better fix to support soci-mysql connector

* SOCI Port-Version, mysql options

* Do not add the options several times

* Remove extra parenthesis

* [soci] Correct cmake config file name

* update baseline

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2021-01-16 19:43:54 -08:00

61 lines
2.0 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
)
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_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(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)
vcpkg_copy_pdbs()