vcpkg/ports/mongo-cxx-driver/portfile.cmake

76 lines
2.7 KiB
CMake
Raw Normal View History

vcpkg_download_distfile(
STRING_PATCHES
URLS "https://github.com/mongodb/mongo-cxx-driver/commit/55ad3447dbd46560eca6e99adfcf195ecd7c1c7a.diff?full_index=1"
FILENAME "mongo-cxx-driver-add-string-55ad3447dbd46560eca6e99adfcf195ecd7c1c7a.patch"
SHA512 a617f3657a065ddc1963007b164f7e96a1e3a53a91a3fefd97ae0be8b42036b1ed572f60f1d7074f6194640bfe37c5c2d5713c7b0853b252fe340c83eb6c852a
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mongodb/mongo-cxx-driver
REF "r${VERSION}"
SHA512 a2e303c503b3e79b30c994888a4a9a31178352a1bb4a9ae73a2e41787c113fdd28e3a0e806abbb9e14419fe1b9aea512bcfe3a54edc126b66f0b732f3df09595
HEAD_REF master
PATCHES
fix-dependencies.patch
${STRING_PATCHES}
2016-12-18 16:26:12 +08:00
)
file(WRITE "${SOURCE_PATH}/build/VERSION_CURRENT" "${VERSION}")
2016-12-18 16:26:12 +08:00
# This port offered C++17 ABI alternative via features.
# This was reduced to boost only.
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
boost BSONCXX_POLY_USE_BOOST
INVERTED_FEATURES
boost BSONCXX_POLY_USE_STD
boost CMAKE_DISABLE_FIND_PACKAGE_Boost
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
2016-12-20 07:16:38 +08:00
OPTIONS
${FEATURE_OPTIONS}
"-DCMAKE_PROJECT_MONGO_CXX_DRIVER_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
-DBSONCXX_HEADER_INSTALL_DIR=include
-DENABLE_TESTS=OFF
-DENABLE_UNINSTALL=OFF
-DMONGOCXX_HEADER_INSTALL_DIR=include
-DNEED_DOWNLOAD_C_DRIVER=OFF
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_Boost
BSONCXX_HEADER_INSTALL_DIR
MONGOCXX_HEADER_INSTALL_DIR
2016-12-18 16:26:12 +08:00
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME "bsoncxx" CONFIG_PATH "lib/cmake/bsoncxx-${VERSION}" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(PACKAGE_NAME "mongocxx" CONFIG_PATH "lib/cmake/mongocxx-${VERSION}")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
function(auto_clean dir)
file(GLOB entries "${dir}/*")
file(GLOB files LIST_DIRECTORIES false "${dir}/*")
foreach(entry IN LISTS entries)
if(entry IN_LIST files)
continue()
endif()
file(GLOB_RECURSE children "${entry}/*")
if(children)
auto_clean("${entry}")
else()
file(REMOVE_RECURSE "${entry}")
endif()
endforeach()
endfunction()
auto_clean("${CURRENT_PACKAGES_DIR}/include")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")