vcpkg/ports/libbson/portfile.cmake
WangWeiLin-MV 431eb6bda0
[mongo-c-driver][bson] Update to 1.26.1 (#37177)
Fix #37143.

### Checklist
- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] ~The "supports" clause reflects platforms that may be fixed by
this new version.~
- [ ] ~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~
- [x] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.

### Test
Port usage and features test pass with following triplets:
* x64-linux
* x64-windows
2024-03-11 13:25:15 -07:00

74 lines
2.5 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mongodb/mongo-c-driver
REF "${VERSION}"
SHA512 ef55fadf66a28a7e9dd513ce9cd36fc91898775d5d20903193b1f321f7814129b1d56c980cfc81cf348830d7bbfde81885585fbcf498ead287675b67c91d470d
HEAD_REF master
PATCHES
fix-include-directory.patch # vcpkg legacy decision
)
file(WRITE "${SOURCE_PATH}/VERSION_CURRENT" "${VERSION}")
# Cannot use string(COMPARE EQUAL ...)
set(ENABLE_STATIC OFF)
set(ENABLE_SHARED OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(ENABLE_STATIC ON)
else()
set(ENABLE_SHARED ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE # because it writes the file VERSION_CURRENT in the source directory
OPTIONS
"-DBUILD_VERSION=${VERSION}"
-DENABLE_BSON=ON
-DENABLE_EXAMPLES=OFF
-DENABLE_ICU=OFF
-DENABLE_MONGOC=OFF
-DENABLE_SASL=OFF
-DENABLE_SNAPPY=OFF
-DENABLE_SRV=OFF
-DENABLE_SSL=OFF
-DENABLE_STATIC=${ENABLE_STATIC}
-DENABLE_SHARED=${ENABLE_SHARED}
-DENABLE_TESTS=OFF
-DENABLE_UNINSTALL=OFF
-DENABLE_ZLIB=SYSTEM
-DENABLE_ZSTD=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Python=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON
MAYBE_UNUSED_VARIABLES
ENABLE_ICU
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME bson-1.0 CONFIG_PATH "lib/cmake/bson-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/bson/bson-macros.h"
"#define BSON_MACROS_H" "#define BSON_MACROS_H\n#ifndef BSON_STATIC\n#define BSON_STATIC\n#endif")
vcpkg_cmake_config_fixup(PACKAGE_NAME libbson-static-1.0 CONFIG_PATH "lib/cmake/libbson-static-1.0")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/libbson-1.0")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/libbson-1.0-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libbson-1.0")
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME libbson-1.0 CONFIG_PATH "lib/cmake/libbson-1.0")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/share/mongo-c-driver"
)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/COPYING"
"${SOURCE_PATH}/THIRD_PARTY_NOTICES"
"${SOURCE_PATH}/src/libbson/THIRD_PARTY_NOTICES"
)