cmake_modules/compilerchecks.cmake
changeset 9222 a19fa86509c2
parent 9221 c4289023ddae
child 9223 71fc5893071c
--- a/cmake_modules/compilerchecks.cmake	Thu Jun 13 17:01:26 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Thu Jun 13 22:01:41 2013 +0200
@@ -12,10 +12,8 @@
 #stack protection, when found it needs to go in the linker flags too
 #it is disabled on win32 because it adds a dll and messes with linker
 #(see 822312 654424 on bugzilla.redhat.com)
-if(NOT WIN32)
-    check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
-endif()
-if(HAVE_STACKPROTECTOR)
+check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
+if(HAVE_STACKPROTECTOR AND (NOT WIN32))
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all -fstack-protector")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all -fstack-protector")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-all -fstack-protector")
@@ -23,10 +21,8 @@
     set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -fstack-protector-all -fstack-protector")
 endif()
 
-#symbol visibility, not supported on Windows
-if(NOT WIN32)
-    check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY)
-endif()
+#symbol visibility, not supported on Windows (so we error out to avoid spam)
+check_c_compiler_flag("-fvisibility=hidden -Werror" HAVE_VISIBILITY)
 if(HAVE_VISIBILITY)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")