vcpkg/ports/soci/portfile.cmake

57 lines
1.9 KiB
CMake
Raw Normal View History

2016-11-17 22:53:37 -05:00
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO SOCI/soci
2018-05-19 18:08:17 -07:00
REF 3.2.3
SHA512 8c597b37efe82c85e6d951f66cb0f818d2c12cb673914bc7b322bc0a9da676e6c02f221c9104fb06d1b4b02fed4e5a4fb872dd3370b9117f248c3b948faf4fb3
HEAD_REF master
2018-05-19 18:08:17 -07:00
PATCHES "${CMAKE_CURRENT_LIST_DIR}/no-define-snprintf.patch"
"${CMAKE_CURRENT_LIST_DIR}/find-libpqd.patch"
2016-11-17 22:53:37 -05: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()
endforeach()
2016-11-17 22:53:37 -05:00
vcpkg_configure_cmake(
2018-05-19 18:08:17 -07:00
SOURCE_PATH ${SOURCE_PATH}/src
PREFER_NINJA
2016-11-17 22:53:37 -05:00
OPTIONS
-DSOCI_TESTS=OFF
-DSOCI_CXX_C11=ON
2018-05-19 18:08:17 -07: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}
-DWITH_MYSQL=OFF
-DWITH_ORACLE=OFF
-DWITH_FIREBIRD=OFF
-DWITH_DB2=OFF
2016-11-17 22:53:37 -05:00
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
2016-11-17 22:53:37 -05:00
# Handle copyright
2018-05-19 18:08:17 -07:00
file(COPY ${SOURCE_PATH}/src/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/soci)
2016-11-17 22:53:37 -05:00
file(RENAME ${CURRENT_PACKAGES_DIR}/share/soci/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/soci/copyright)
vcpkg_copy_pdbs()