cmake_modules/FindGHC.cmake
author nemo
Mon, 11 May 2015 13:53:08 -0400
changeset 10942 5d7dd938dedc
parent 10109 91d126fbd7bd
child 13291 31615a2e0db1
permissions -rw-r--r--
This probably fixes bug #839 - mine time was hardcoded to 3000 in Attack, instead of using the "0 as undefined" input that other places were using. When re653e96b0ec3 started paying attention to the input parameter, this previously ignored value became a problem.
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)
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents: 8671
diff changeset
    20
    # check ghc version
8671
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