vcpkg/ports/soci/portfile.cmake
Andrei Lebedev 010e88c647 [soci] Add patches for boost and postgresql (#6328)
Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
2019-05-09 15:22:50 -07:00

58 lines
2.0 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO SOCI/soci
REF c15b178a44b99ed3ff7fd953837fb97f6314abb7
SHA512 037c44f29e80b5ec57046606b4672088917d469e9d2254e3e15253e170026cf0fe17e4f79a4b01df22fe7032708ca87354b1560d9880d4d165cdef869c3c6081
HEAD_REF master
PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-Deduce-reference-in-boost-fusion-for_each.patch"
"${CMAKE_CURRENT_LIST_DIR}/0002-Find-PostgreSQL-debug-library.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()
endforeach()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSOCI_TESTS=OFF
-DSOCI_CXX_C11=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}
-DWITH_MYSQL=OFF
-DWITH_ORACLE=OFF
-DWITH_FIREBIRD=OFF
-DWITH_DB2=OFF
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake ${CURRENT_PACKAGES_DIR}/debug/cmake ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/soci)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/soci/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/soci/copyright)
vcpkg_copy_pdbs()