From 00cb9f4e6f2fc92650398cbbd435e0dbf264331b Mon Sep 17 00:00:00 2001 From: durswd Date: Mon, 2 Sep 2019 12:32:29 +0900 Subject: [PATCH 1/2] I supported clang-cl with BUILD_SHARED_LIBS --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 808330e..732d153 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,13 +531,13 @@ if (NOT BUILD_SHARED_LIBS) else (NOT BUILD_SHARED_LIBS) target_compile_definitions (glog PRIVATE GOOGLE_GLOG_IS_A_DLL=1) - if (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT) + if (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT AND NOT MSVC) set (_EXPORT "__attribute__((visibility(\"default\")))") set (_IMPORT "") elseif (HAVE___DECLSPEC) set (_EXPORT "__declspec(dllexport)") set (_IMPORT "__declspec(dllimport)") - endif (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT) + endif (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT AND NOT MSVC) target_compile_definitions (glog PRIVATE "GOOGLE_GLOG_DLL_DECL=${_EXPORT}") From a8fad525e58c969bfed8e13670ab98eca4688732 Mon Sep 17 00:00:00 2001 From: durswd Date: Mon, 2 Sep 2019 13:28:18 +0900 Subject: [PATCH 2/2] Changed the order of conditions --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 732d153..4254c6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,13 +531,13 @@ if (NOT BUILD_SHARED_LIBS) else (NOT BUILD_SHARED_LIBS) target_compile_definitions (glog PRIVATE GOOGLE_GLOG_IS_A_DLL=1) - if (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT AND NOT MSVC) - set (_EXPORT "__attribute__((visibility(\"default\")))") - set (_IMPORT "") - elseif (HAVE___DECLSPEC) + if (HAVE___DECLSPEC) set (_EXPORT "__declspec(dllexport)") set (_IMPORT "__declspec(dllimport)") - endif (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT AND NOT MSVC) + elseif (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT) + set (_EXPORT "__attribute__((visibility(\"default\")))") + set (_IMPORT "") + endif (HAVE___DECLSPEC) target_compile_definitions (glog PRIVATE "GOOGLE_GLOG_DLL_DECL=${_EXPORT}")