cmake_modules/FindGHC.cmake
author sheepluva
Fri, 06 Dec 2013 23:53:35 +0100
changeset 9760 395ca7fe6362
parent 8671 a9957b7797f3
child 10109 91d126fbd7bd
permissions -rw-r--r--
It seems that at the current state it is necessary to protect sending stats/ending game from multiple execution, as that can happen if you e.g. fail a mission more than once in the same tick (e.g. destroying two essential crates at the same time) Otherwise you can get a blank / stuck frontend (e.g. when using deagle to shoot the two last crates at the same time)! the best approach might be to never call the function that sends stats and ends game from any event handler directly, but instead have a flag 'isFailed' that is set to true when any of the possible fails happen and to check that flag every tick to send stats and end game if true
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8671
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     1
# - Try to find the Glasgow Haskell Compiler executable
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     2
# Once done this will define
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     3
#
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     4
#  GHC_FOUND       - system has GHC
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     5
#  GHC_VERSION     - GHC version
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     6
#  GHC_EXECUTABLE  - GHC executable
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     7
#
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     8
# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com>
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
     9
#
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    10
# Redistribution and use is allowed according to the terms of the BSD license.
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    11
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    12
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    13
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    14
find_program(GHC_EXECUTABLE
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    15
    NAMES ghc
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    16
    PATHS /opt/local/bin /usr/local/bin /usr/bin
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    17
    )
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    18
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    19
if (GHC_EXECUTABLE)
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    20
    # check Freepascal version
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    21
    execute_process(COMMAND ${GHC_EXECUTABLE} -V
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    22
                    OUTPUT_VARIABLE GHC_VERSION_OUTPUT
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    23
                    ERROR_VARIABLE GHC_VERSION_ERROR
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    24
                    RESULT_VARIABLE GHC_VERSION_RESULT
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    25
                    OUTPUT_STRIP_TRAILING_WHITESPACE
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    26
                    )
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    27
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    28
    if(${GHC_VERSION_RESULT} EQUAL 0)
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    29
        string(REGEX MATCH "([0-9]+)" GHC_VERSION ${GHC_VERSION_OUTPUT})
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    30
    else()
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    31
        message(SEND_ERROR "Command \"${GHC_EXECUTABLE} -V\" failed with output: ${GHC_VERSION_ERROR}")
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    32
    endif()
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    33
endif()
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    34
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    35
include(FindPackageHandleStandardArgs)
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    36
find_package_handle_standard_args(GHC DEFAULT_MSG GHC_EXECUTABLE GHC_VERSION)
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    37
mark_as_advanced(GHC_VERSION)
a9957b7797f3 write FindGHC.cmake for haskell stuff
koda
parents:
diff changeset
    38