summaryrefslogtreecommitdiff
path: root/lib/CMakeLists.txt
diff options
context:
space:
mode:
authorJakub Zakrzewski <slither.jz@gmail.com>2016-09-04 12:37:46 +0200
committerJakub Zakrzewski <slither.jz@gmail.com>2016-09-10 00:35:38 +0200
commit6140dfcf3e7845f11dee755de6865379aa96dab7 (patch)
treeb04e4001ee22651132fda45756d04105362514d1 /lib/CMakeLists.txt
parent83ef21e5e9946de2805ae10cc5e6ef9431b22702 (diff)
downloadcurl-6140dfcf3e7845f11dee755de6865379aa96dab7.tar.gz
CMake: Try to (un-)hide private library symbols
Detect support for compiler symbol visibility flags and apply those according to CURL_HIDDEN_SYMBOLS option. It should work true to the autotools build except it tries to unhide symbols on Windows when requested and prints warning if it fails. Ref: https://github.com/curl/curl/issues/981#issuecomment-242665951 Reported-by: Daniel Stenberg
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r--lib/CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 49a340938..eb2de6d87 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -87,6 +87,11 @@ endif()
set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL)
+if(HIDES_CURL_PRIVATE_SYMBOLS)
+ set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
+ set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_FLAGS ${CURL_CFLAG_SYMBOLS_HIDE})
+endif()
+
# Remove the "lib" prefix since the library is already named "libcurl".
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")