CMakeLists.txt
changeset 8669 3f9853888d4f
parent 8666 1652c1d9adc8
child 8671 a9957b7797f3
--- a/CMakeLists.txt	Wed Mar 06 12:18:42 2013 +0100
+++ b/CMakeLists.txt	Wed Mar 06 15:09:29 2013 +0100
@@ -226,16 +226,16 @@
 endif()
 
 #TODO: find out why we need this...
-include(CheckCSourceCompiles)
-set(CMAKE_REQUIRED_FLAG "-Wl,-z -Wl,noexecstack")
-check_c_source_compiles("int main(void) { return 0; }" HAVE_NOEXECSTACK)
+include(CheckCCompilerFlag)
+set(CMAKE_REQUIRED_FLAGS "-Wl,-z -Wl,noexecstack")
+check_c_compiler_flag("" HAVE_NOEXECSTACK) #empty because we are testing a linker flag
 if(HAVE_NOEXECSTACK)
     list(APPEND pascal_flags "-k-z" "-knoexecstack")
     if(NOT ${MINIMAL_FLAGS})
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAG}")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
     endif()
 endif()
-unset(CMAKE_REQUIRED_FLAG)
+unset(CMAKE_REQUIRED_FLAGS)
 
 #parse additional parameters
 if(FPFLAGS OR GHFLAGS)