cmake_modules/compilerchecks.cmake
changeset 9221 c4289023ddae
parent 9220 5e7db24f3489
child 9222 a19fa86509c2
--- a/cmake_modules/compilerchecks.cmake	Thu Jun 13 15:37:52 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Thu Jun 13 17:01:26 2013 +0200
@@ -12,8 +12,10 @@
 #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)
-check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
-if(HAVE_STACKPROTECTOR AND (NOT WIN32))
+if(NOT WIN32)
+    check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
+endif()
+if(HAVE_STACKPROTECTOR)
     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")
@@ -21,8 +23,10 @@
     set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -fstack-protector-all -fstack-protector")
 endif()
 
-#symbol visibility, not supported on Windows (so we error out to avoid spam)
-check_c_compiler_flag("-fvisibility=hidden -Werror" HAVE_VISIBILITY)
+#symbol visibility, not supported on Windows
+if(NOT WIN32)
+    check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY)
+endif()
 if(HAVE_VISIBILITY)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")