From 6140dfcf3e7845f11dee755de6865379aa96dab7 Mon Sep 17 00:00:00 2001 From: Jakub Zakrzewski Date: Sun, 4 Sep 2016 12:37:46 +0200 Subject: 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 --- tests/libtest/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/libtest') diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt index cc9d7e1f8..a7449c374 100644 --- a/tests/libtest/CMakeLists.txt +++ b/tests/libtest/CMakeLists.txt @@ -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 -- cgit v1.2.3