CMakeLists.txt
changeset 8665 3ff8694d9e22
parent 8659 e49056d3aba1
child 8666 1652c1d9adc8
--- a/CMakeLists.txt	Wed Mar 06 10:13:23 2013 +0100
+++ b/CMakeLists.txt	Wed Mar 06 11:18:54 2013 +0100
@@ -230,6 +230,17 @@
     set(CMAKE_CXX_FLAGS_DEBUG "-Wall -DDEBUG")
 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)
+if(HAVE_NOEXECSTACK)
+    list(APPEND pascal_flags "-k-z" "-knoexecstack")
+    if(NOT ${MINIMAL_FLAGS})
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAG}")
+    endif()
+endif()
+unset(CMAKE_REQUIRED_FLAG)
 
 #parse additional parameters
 if(FPFLAGS OR GHFLAGS)