diff options
author | Chris Robinson <[email protected]> | 2011-09-21 23:41:52 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-21 23:41:52 -0700 |
commit | e81e20446f9d8ded91062e2c3c6287db196bd72f (patch) | |
tree | 4dd77d9900848a49827bb3e9caaff052a42ba87e | |
parent | 64080250ffbdfbdfef47f2f9ede8a8c3a8e4a984 (diff) |
Don't use the -fvisibility switch if the visibility attributes didn't work
-rw-r--r-- | CMakeLists.txt | 17 |
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() |