diff options
author | Jakub Zakrzewski <slither.jz@gmail.com> | 2016-09-04 12:37:46 +0200 |
---|---|---|
committer | Jakub Zakrzewski <slither.jz@gmail.com> | 2016-09-10 00:35:38 +0200 |
commit | 6140dfcf3e7845f11dee755de6865379aa96dab7 (patch) | |
tree | b04e4001ee22651132fda45756d04105362514d1 /lib/CMakeLists.txt | |
parent | 83ef21e5e9946de2805ae10cc5e6ef9431b22702 (diff) | |
download | curl-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.txt | 5 |
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 "") |