]> granicus.if.org Git - taglib/commitdiff
Improve CMake VISIBILITY_HIDDEN option handling (#810)
authorevpobr <evpobr@gmail.com>
Sat, 27 Oct 2018 00:26:53 +0000 (05:26 +0500)
committerStephen F. Booth <me@sbooth.org>
Sat, 27 Oct 2018 00:26:53 +0000 (19:26 -0500)
Use standard CMake's CXX_VISIBILITY_PRESET property.

CMakeLists.txt
bindings/c/CMakeLists.txt
taglib/CMakeLists.txt

index 3e081ea223f19dd0e02dae5d7be5b57f74f76b7a..2de06324e44179898374403a7fc990120e35e0ef 100644 (file)
@@ -36,10 +36,6 @@ if(ENABLE_CCACHE)
 endif()
 
 option(VISIBILITY_HIDDEN "Build with -fvisibility=hidden" OFF)
-if(VISIBILITY_HIDDEN)
-  add_definitions(-fvisibility=hidden)
-endif()
-
 option(BUILD_TESTS "Build the test suite" OFF)
 option(BUILD_EXAMPLES "Build the examples" OFF)
 option(BUILD_BINDINGS "Build the bindings" ON)
index 387f1bd19531aa8ac57dda668a3d2a420d2cb643..ebb1267f1e355398a5db56816518f56446a17d49 100644 (file)
@@ -21,7 +21,14 @@ set(tag_c_HDRS tag_c.h)
 add_library(tag_c tag_c.cpp ${tag_c_HDRS})
 
 target_link_libraries(tag_c tag)
-set_target_properties(tag_c PROPERTIES PUBLIC_HEADER "${tag_c_HDRS}")
+set_target_properties(tag_c PROPERTIES
+  PUBLIC_HEADER "${tag_c_HDRS}"
+  DEFINE_SYMBOL MAKE_TAGLIB_LIB
+)
+if(VISIBILITY_HIDDEN)
+       set_target_properties(tag_c PROPERTIES C_VISIBILITY_PRESET hidden
+       )
+endif()
 if(BUILD_FRAMEWORK)
   set_target_properties(tag_c PROPERTIES FRAMEWORK TRUE)
 endif()
index 25041d251d6aaaca9b5962ebc7cc0a4953bed8df..649390714ddd1526447c7e9c8f2861f8148f8a16 100644 (file)
@@ -347,6 +347,11 @@ set_target_properties(tag PROPERTIES
   LINK_INTERFACE_LIBRARIES ""
   PUBLIC_HEADER "${tag_HDRS}"
 )
+if(VISIBILITY_HIDDEN)
+       set_target_properties(tag PROPERTIES C_VISIBILITY_PRESET hidden
+       )
+endif()
+
 if(BUILD_FRAMEWORK)
   unset(INSTALL_NAME_DIR)
   set_target_properties(tag PROPERTIES