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
This commit is contained in:
Jakub Zakrzewski 2016-09-04 12:37:46 +02:00
parent 83ef21e5e9
commit 6140dfcf3e
5 changed files with 72 additions and 3 deletions

View file

@ -43,6 +43,10 @@ if(NOT WIN32)
# library at (tests)/libtest/.libs/libhostname.so
set_target_properties(hostname PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.libs)
if(HIDES_CURL_PRIVATE_SYMBOLS)
set_property(TARGET hostname APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
set_property(TARGET hostname APPEND PROPERTY COMPILE_FLAGS ${CURL_CFLAG_SYMBOLS_HIDE})
endif()
endif()
# # files used only in some libcurl test programs