cmake_modules/FindGHC.cmake
author nemo
Mon, 10 Apr 2017 12:06:43 -0400
changeset 12213 bb5522e88ab2
parent 10109 91d126fbd7bd
child 13291 31615a2e0db1
permissions -rw-r--r--
bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
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