cmake_modules/compilerchecks.cmake
changeset 9225 d8d929f92633
parent 9223 71fc5893071c
child 9298 2d88d01bad07
--- a/cmake_modules/compilerchecks.cmake	Thu Jun 13 22:27:23 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Thu Jun 13 22:50:18 2013 +0200
@@ -14,18 +14,18 @@
 #(see 822312 654424 on bugzilla.redhat.com)
 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")
-    set(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector-all -fstack-protector")
-    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -fstack-protector-all -fstack-protector")
+    add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector")
+    add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector")
+    add_flag_append(CMAKE_EXE_LINKER_FLAGS "-fstack-protector-all -fstack-protector")
+    add_flag_append(CMAKE_SHARED_LIBRARY_C_FLAGS "-fstack-protector-all -fstack-protector")
+    add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fstack-protector-all -fstack-protector")
 endif()
 
 #symbol visibility, not supported on Windows
 check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY)
 if(HAVE_VISIBILITY AND (NOT WIN32))
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+    add_flag_append(CMAKE_C_FLAGS "-fvisibility=hidden")
+    add_flag_append(CMAKE_CXX_FLAGS "-fvisibility=hidden")
 endif()
 
 
@@ -33,21 +33,21 @@
 set(CMAKE_REQUIRED_FLAGS "-Wl,-z,noexecstack")
 check_c_compiler_flag("" HAVE_NOEXECSTACK)
 if(HAVE_NOEXECSTACK)
-    append_linker_flag("-znoexecstack")
+    add_linker_flag("-znoexecstack")
 endif()
 
 #check for full relro on ELF, Debian security
 set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
 check_c_compiler_flag("" HAVE_RELROFULL)
 if(HAVE_RELROFULL)
-    append_linker_flag("-zrelro")
-    append_linker_flag("-znow")
+    add_linker_flag("-zrelro")
+    add_linker_flag("-znow")
 else()
     #if full relro is not available, try partial relro
     set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro")
     check_c_compiler_flag("" HAVE_RELROPARTIAL)
     if(HAVE_RELROPARTIAL)
-        append_linker_flag("-zrelro")
+        add_linker_flag("-zrelro")
     endif()
 endif()
 
@@ -55,21 +55,21 @@
 set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
 check_c_compiler_flag("" HAVE_WINASLR)
 if(HAVE_WINASLR)
-    append_linker_flag("--nxcompat")
+    add_linker_flag("--nxcompat")
 endif()
 
 #check for DEP on Windows XP SP2 or later, requires binutils >= 2.20
 set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
 check_c_compiler_flag("" HAVE_WINDEP)
 if(HAVE_WINDEP)
-    append_linker_flag("--dynamicbase")
+    add_linker_flag("--dynamicbase")
 endif()
 
 #this is actually an optimisation
 set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed")
 check_c_compiler_flag("" HAVE_ASNEEDED)
 if(HAVE_ASNEEDED)
-    append_linker_flag("--as-needed")
+    add_linker_flag("--as-needed")
 endif()
 
 #always unset or these flags will be spread everywhere