author | koda |
Mon, 13 May 2013 22:53:20 +0200 | |
changeset 8985 | fe8d1a476f0b |
parent 8665 | 3ff8694d9e22 |
permissions | -rw-r--r-- |
8665
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
1 |
# - Try to find the FreePascal executable |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
2 |
# Once done this will define |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
3 |
# |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
4 |
# FREEPASCAL_FOUND - system has Freepascal |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
5 |
# FREEPASCAL_VERSION - Freepascal version |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
6 |
# FREEPASCAL_EXECUTABLE - Freepascal executable |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
7 |
# |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
8 |
# Copyright (c) 2012, Bryan Dunsmore <dunsmoreb@gmail.com> |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
9 |
# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com> |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
10 |
# |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
11 |
# Redistribution and use is allowed according to the terms of the BSD license. |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
12 |
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
13 |
|
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
14 |
|
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
15 |
find_program(FREEPASCAL_EXECUTABLE |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
16 |
NAMES fpc |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
17 |
PATHS /opt/local/bin /usr/local/bin /usr/bin |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
18 |
) |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
19 |
|
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
20 |
if (FREEPASCAL_EXECUTABLE) |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
21 |
# check Freepascal version |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
22 |
execute_process(COMMAND ${FREEPASCAL_EXECUTABLE} -iV |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
23 |
OUTPUT_VARIABLE FREEPASCAL_VERSION |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
24 |
ERROR_VARIABLE FREEPASCAL_VERSION_ERROR |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
25 |
RESULT_VARIABLE FREEPASCAL_VERSION_RESULT |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
26 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
27 |
) |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
28 |
|
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
29 |
if(NOT ${FREEPASCAL_VERSION_RESULT} EQUAL 0) |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
30 |
message(SEND_ERROR "Command \"${FREEPASCAL_EXECUTABLE} -iV\" failed with output: ${FREEPASCAL_VERSION_ERROR}") |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
31 |
endif() |
8164
b12634f2e1b2
Move noexecstack flags to Freepascal module and refactor.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8162
diff
changeset
|
32 |
endif() |
8162
b97a17bf89ec
Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
33 |
|
8665
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
34 |
include(FindPackageHandleStandardArgs) |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
35 |
find_package_handle_standard_args(FreePascal DEFAULT_MSG FREEPASCAL_EXECUTABLE FREEPASCAL_VERSION) |
3ff8694d9e22
rewritten findfreepascal, moved checkstack code elsewhere
koda
parents:
8285
diff
changeset
|
36 |
mark_as_advanced(FREEPASCAL_VERSION) |
8162
b97a17bf89ec
Move code for Freepascal to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
37 |