cmake_modules/FindFreepascal.cmake
author dag10
Mon, 14 Jan 2013 11:19:59 +0100
changeset 8377 869f80966a77
parent 8285 a1500ffdc343
permissions -rw-r--r--
GCI2012: Improve Game Configuration Widget - Refactored mapmodel+datamanager to have two separate map models for static and mission maps, and then three static MapInfos in MapModel for the three special maps (random, maze, drawn). - Created theme selector dialog. - Created seed view/edit dialog. - Enlarged start icon on pagemultiplayer and pagenetgame, and added Start.png. - Moved "Settings" button on pagemultiplayer and pagenetgame from middle of page to page footer. - Added "load drawing" button to mapcontainer widget. - Map preview is no longer the randomize button; The randomize functionality is now in a button of its own. - Map preview no longer grays out (isn't disabled) when in slave mode. - Seed is now viewable and copyable when in slave mode -- but not editable. - You should now use the property master (isMaster() and setMaster()) on gamecfgwidget and mapcontainer instead of the enabled property. This is because some widgets (e.g. "view/edit seed" button and map preview) shouldn't be disabled, when all other widgets should be. - Added mission map descriptions w/ locale support in INI format in mapname/desc.txt if applicable. Use '|' for line break.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8162
b97a17bf89ec Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
     1
# Load Freepascal
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
     2
if (FPC)
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
     3
    set(FPC_EXECUTABLE ${FPC})
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
     4
else()
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
     5
    find_program(FPC_EXECUTABLE
8162
b97a17bf89ec Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
     6
        NAMES fpc
b97a17bf89ec Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
     7
        PATHS /opt/local/bin /usr/local/bin /usr/bin)
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
     8
endif()
8162
b97a17bf89ec Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
     9
b97a17bf89ec Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
    10
# Check Freepascal version
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    11
if (FPC_EXECUTABLE)
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    12
    exec_program(${FPC_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE FPC_VERSION_FULL)
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    13
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    14
    string(REGEX MATCH "[0-9]+\\.[0-9]+" FPC_VERSION_LONG "${FPC_VERSION_FULL}")
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    15
    string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" FPC_VERSION "${FPC_VERSION_LONG}")
8285
a1500ffdc343 cmake set variable and typo
koda
parents: 8283
diff changeset
    16
    message(STATUS "Found Freepascal: ${FPC_EXECUTABLE} (version ${FPC_VERSION})")
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    17
else()
8195
37d47f09f981 caught a few more possible glitches in engine cmakefile
koda
parents: 8188
diff changeset
    18
    message(FATAL_ERROR "Could NOT find Freepascal")
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    19
endif()
8162
b97a17bf89ec Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
    20
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    21
# Check for noexecstack flag support
8283
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8195
diff changeset
    22
message(STATUS "Checking whether linker needs explicit noexecstack")
8164
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    23
set(NOEXECSTACK_FLAGS "-k-z" "-knoexecstack")
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    24
file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.")
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    25
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    26
execute_process(COMMAND ${FPC_EXECUTABLE} ${NOEXECSTACK_FLAGS} checkstack.pas
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    27
    WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    28
    RESULT_VARIABLE TEST_NOEXECSTACK
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    29
    OUTPUT_QUIET ERROR_QUIET)
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    30
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    31
if (TEST_NOEXECSTACK)
b12634f2e1b2 Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8162
diff changeset
    32
    set(NOEXECSTACK_FLAGS "")
8166
5bc0fc0bab4d Refactor Freepascal module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8164
diff changeset
    33
    message(STATUS "Checking whether linker needs explicit noexecstack -- no")
8188
4c166505e5c8 fix compiling engine (bug introduced in r33868aea694c)
koda
parents: 8166
diff changeset
    34
else(TEST_NOEXECSTACK)
8166
5bc0fc0bab4d Refactor Freepascal module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8164
diff changeset
    35
    message(STATUS "Checking whether linker needs explicit noexecstack -- yes")
8188
4c166505e5c8 fix compiling engine (bug introduced in r33868aea694c)
koda
parents: 8166
diff changeset
    36
endif(TEST_NOEXECSTACK)
8195
37d47f09f981 caught a few more possible glitches in engine cmakefile
koda
parents: 8188
diff changeset
    37