diff options
author | Chris Robinson <[email protected]> | 2023-01-12 01:23:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-01-12 01:55:45 -0800 |
commit | 97f2c28ddd79474e163f62d666fc8ce555f31e0f (patch) | |
tree | 8716f342d481cb8193bc58c00bba604de3fa0e18 /CMakeLists.txt | |
parent | 976049f02dee88e9135eb80ed2a994479a4e6a39 (diff) |
Use cmake's visibility attributes
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c721b641..97192131 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") endif() endif() +set(CMAKE_C_VISIBILITY_PRESET hidden) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + if(COMMAND CMAKE_POLICY) cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0005 NEW) @@ -42,6 +45,9 @@ if(COMMAND CMAKE_POLICY) if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif(POLICY CMP0054) + if(POLICY CMP0063) + cmake_policy(SET CMP0063 NEW) + endif(POLICY CMP0063) if(POLICY CMP0075) cmake_policy(SET CMP0075 NEW) endif(POLICY CMP0075) @@ -351,13 +357,6 @@ else() endif() endif() - if(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY) - check_c_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH) - if(HAVE_VISIBILITY_HIDDEN_SWITCH) - set(C_FLAGS ${C_FLAGS} -fvisibility=hidden) - endif() - endif() - set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}") endif() @@ -1137,17 +1136,7 @@ set(OBOE_TARGET ) if(ANDROID) set(OBOE_SOURCE "" CACHE STRING "Source directory for Oboe.") if(OBOE_SOURCE) - # Force Oboe to build with hidden symbols. Don't want to be exporting - # them from OpenAL. - set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - check_cxx_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH) - if(HAVE_VISIBILITY_HIDDEN_SWITCH) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") - endif() add_subdirectory(${OBOE_SOURCE} ./oboe) - set(CMAKE_CXX_FLAGS ${OLD_CXX_FLAGS}) - unset(OLD_CXX_FLAGS) - set(OBOE_TARGET oboe) else() find_package(oboe CONFIG) |