hedgewars/CMakeLists.txt
changeset 476 a4e975f70b60
parent 433 9f8f22094c0e
child 534 92fb2b0d5117
equal deleted inserted replaced
475:1e46d45da242 476:a4e975f70b60
    45 
    45 
    46 if (fpc_executable)
    46 if (fpc_executable)
    47 	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
    47 	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
    48 endif (fpc_executable)
    48 endif (fpc_executable)
    49 
    49 
       
    50 set (noexecstack_flags "-k-z" "-knoexecstack")
       
    51 FILE(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.")
       
    52 
       
    53 EXEC_PROGRAM(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH}
       
    54 		ARGS ${noexecstack_flags} checkstack.pas
       
    55 		OUTPUT_VARIABLE noout
       
    56 		RETURN_VALUE testnoexecstack)
       
    57 
       
    58 if (${testnoexecstack})
       
    59 set (noexecstack_flags "")
       
    60 endif (${testnoexecstack})
       
    61 
    50 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    62 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
    51 if (fpc_version)
    63 if (fpc_version)
    52 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    64 	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
    53 	string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    65 	string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
    54 	string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    66 	string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
    55 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    67 	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
    56 	if (fpc_ver LESS "010904")
    68 	if (fpc_ver LESS "010904")
    57 		message("Minimum required version of FreePascal is 1.9.4")
    69 		message("Minimum required version of FreePascal is 1.9.4")
    58 	else (fpc_ver LESS "010904")
    70 	else (fpc_ver LESS "010904")
    59 		set(pascal_compiler ${fpc_executable})
    71 		set(pascal_compiler ${fpc_executable})
    60 		set(pascal_compiler_flags "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
    72 		set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
    61 	endif (fpc_ver LESS "010904")
    73 	endif (fpc_ver LESS "010904")
    62 endif (fpc_version)
    74 endif (fpc_version)
    63 
    75 
    64 if (NOT pascal_compiler)
    76 if (NOT pascal_compiler)
    65 	message(FATAL_ERROR "No Pascal compiler found!")
    77 	message(FATAL_ERROR "No Pascal compiler found!")