diff --git a/ports/mongo-cxx-driver/portfile.cmake b/ports/mongo-cxx-driver/portfile.cmake index 5ea949abbd..7c3247d483 100644 --- a/ports/mongo-cxx-driver/portfile.cmake +++ b/ports/mongo-cxx-driver/portfile.cmake @@ -76,6 +76,13 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmongocxx.lib ${CURRENT_PACKAGES_DIR}/debug/lib/mongocxx.lib) + + # define MONGOCXX_STATIC in config/export.hpp + vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/static.patch + ) else() file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libbsoncxx.lib) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libbsoncxx.lib) diff --git a/ports/mongo-cxx-driver/static.patch b/ports/mongo-cxx-driver/static.patch new file mode 100644 index 0000000000..a485efe3d9 --- /dev/null +++ b/ports/mongo-cxx-driver/static.patch @@ -0,0 +1,12 @@ +diff --git a/mongocxx/config/export.hpp b/mongocxx/config/export.hpp +index 61a3e74..7fc951c 100644 +--- a/mongocxx/config/export.hpp ++++ b/mongocxx/config/export.hpp +@@ -2,6 +2,7 @@ + #ifndef MONGOCXX_API_H + #define MONGOCXX_API_H + ++#define MONGOCXX_STATIC + #ifdef MONGOCXX_STATIC + # define MONGOCXX_API + # define MONGOCXX_PRIVATE