aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsdcb <sdflysha@qq.com>2016-11-21 11:53:06 +0800
committersdcb <sdflysha@qq.com>2016-11-21 11:53:06 +0800
commit51a9334d1b16cf00f3e547eb9e6b162ac34c526e (patch)
treec4ed46b8e9ef92798c3f18d805106bbb76b57f35
parent2538bdac5a8932c93efe5b87666e373c8c817ca4 (diff)
downloadvcpkg-51a9334d1b16cf00f3e547eb9e6b162ac34c526e.tar.gz
vcpkg-51a9334d1b16cf00f3e547eb9e6b162ac34c526e.zip
Fix static build runtime error.
-rw-r--r--ports/libbson/portfile.cmake7
-rw-r--r--ports/libbson/static.patch13
2 files changed, 20 insertions, 0 deletions
diff --git a/ports/libbson/portfile.cmake b/ports/libbson/portfile.cmake
index 7f219a4c7..4f8dc0e25 100644
--- a/ports/libbson/portfile.cmake
+++ b/ports/libbson/portfile.cmake
@@ -30,6 +30,13 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-1.0.lib)
+
+ # drop the __declspec(dllimport) when building static
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/static.patch
+ )
else()
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-static-1.0.lib)
diff --git a/ports/libbson/static.patch b/ports/libbson/static.patch
new file mode 100644
index 000000000..adb52fa4f
--- /dev/null
+++ b/ports/libbson/static.patch
@@ -0,0 +1,13 @@
+diff --git a/bson-macros.h b/bson-macros.h
+index 909bf6c..0a1f612 100644
+--- a/bson-macros.h
++++ b/bson-macros.h
+@@ -69,7 +69,7 @@
+ # ifdef BSON_COMPILATION
+ # define BSON_API __declspec(dllexport)
+ # else
+-# define BSON_API __declspec(dllimport)
++# define BSON_API
+ # endif
+ #elif defined(__GNUC__)
+ # define BSON_API __attribute__ ((visibility ("default")))