aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt17
1 files changed, 10 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d2f7658..5552152c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -181,6 +181,7 @@ IF(WIN32)
ENDIF()
ELSE()
SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ # Yes GCC, really don't accept visibility modes you don't support
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Werror")
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
@@ -195,13 +196,15 @@ ELSE()
ENDIF()
ENDIF()
- CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_INTERNAL_SWITCH)
- IF(HAVE_VISIBILITY_INTERNAL_SWITCH)
- ADD_DEFINITIONS(-fvisibility=internal)
- ELSE()
- CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
- IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
- ADD_DEFINITIONS(-fvisibility=hidden)
+ IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
+ CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_INTERNAL_SWITCH)
+ IF(HAVE_VISIBILITY_INTERNAL_SWITCH)
+ ADD_DEFINITIONS(-fvisibility=internal)
+ ELSE()
+ CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
+ IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
+ ADD_DEFINITIONS(-fvisibility=hidden)
+ ENDIF()
ENDIF()
ENDIF()