[gflags] Fix bug with static linking

This commit is contained in:
Arkadiy Shapkin 2017-05-06 20:53:22 +03:00
parent 22848e4b7e
commit 2b561712dc
2 changed files with 24 additions and 7 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/gflags.h.in b/src/gflags.h.in
index 43b3f7a..82e640f 100644
--- a/src/gflags.h.in
+++ b/src/gflags.h.in
@@ -86,7 +86,7 @@
// We always want to export variables defined in user code
#ifndef GFLAGS_DLL_DEFINE_FLAG
-# ifdef _MSC_VER
+# if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport)
# else
# define GFLAGS_DLL_DEFINE_FLAG

View File

@ -1,14 +1,18 @@
include(vcpkg_common_functions)
find_program(GIT git)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/gflags/gflags/archive/v2.2.0.zip"
FILENAME "gflags-v2.2.0.zip"
SHA512 638d094cdcc759a35ebd0e57900216deec6113242d2dcc964beff7b88cf56e3dbab3dce6e10a055bfd94cb5daebb8632382219a5ef40a689e14c76b263d3eca5)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO gflags/gflags
REF v2.2.0
SHA512 e2106ca70ff539024f888bca12487b3bf7f4f51928acf5ae3e1022f6bbd5e3b7882196ec50b609fd52f739e1f7b13eec7d4b3535d8216ec019a3577de6b4228d
HEAD_REF master
)
vcpkg_extract_source_archive(${ARCHIVE})
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gflags-2.2.0)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-static-linking.patch"
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}