summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-01 00:57:48 -0800
committerChris Robinson <[email protected]>2007-12-01 00:57:48 -0800
commit86cced248be365c3e7597deeab53d6c25636bc54 (patch)
tree4e33aa3a9f0603000a702b7b43caf9dc7f1f6005
parent29edd5c7ee08790f5a90ce5d6c52577578de74ef (diff)
Check for the -fvisibility switch before the visibility attribute
-rw-r--r--CMakeLists.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6caaa77..7de8ae76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,10 +75,13 @@ ELSE()
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
- CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
- int main() {return 0;}" HAVE_GCC_VISIBILITY)
- IF("${HAVE_GCC_VISIBILITY}")
- ADD_DEFINITIONS(-fvisibility=hidden -DHAVE_GCC_VISIBILITY)
+ CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_SWITCH)
+ IF("${HAVE_VISIBILITY_SWITCH}")
+ CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
+ int main() {return 0;}" HAVE_GCC_VISIBILITY)
+ IF("${HAVE_GCC_VISIBILITY}")
+ ADD_DEFINITIONS(-fvisibility=hidden -DHAVE_GCC_VISIBILITY)
+ ENDIF()
ENDIF()
ENDIF()
ENDIF()