author | koda |
Fri, 22 Mar 2013 10:34:50 +0100 | |
branch | cmake_pascal |
changeset 8829 | 6940e86a7df6 |
parent 8764 | f16bcb3dba9e |
child 8834 | edceeafff671 |
permissions | -rw-r--r-- |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
1 |
# Determine the compiler to use for Pascal programs |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
2 |
# NOTE, a generator may set CMAKE_Pascal_COMPILER before |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
3 |
# loading this file to force a compiler. |
8752
48cf2ccb83c6
with lot of hackery, use add_executable on pascal files, SUCCSS
koda
parents:
8750
diff
changeset
|
4 |
# use environment variable Pascal first if defined by user, next use |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
5 |
# the cmake variable CMAKE_GENERATOR_PASCAL which can be defined by a generator |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
6 |
# as a default compiler |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
7 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
8 |
IF(NOT CMAKE_Pascal_COMPILER) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
9 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
10 |
# prefer the environment variable FPC |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
11 |
IF($ENV{FPC} MATCHES ".+") |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
12 |
GET_FILENAME_COMPONENT(CMAKE_Pascal_COMPILER_INIT $ENV{FPC} PROGRAM PROGRAM_ARGS CMAKE_Pascal_FLAGS_ENV_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
13 |
IF(CMAKE_Pascal_FLAGS_ENV_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
14 |
SET(CMAKE_Pascal_COMPILER_ARG1 "${CMAKE_Pascal_FLAGS_ENV_INIT}" CACHE STRING "First argument to Pascal compiler") |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
15 |
ENDIF(CMAKE_Pascal_FLAGS_ENV_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
16 |
IF(EXISTS ${CMAKE_Pascal_COMPILER_INIT}) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
17 |
ELSE(EXISTS ${CMAKE_Pascal_COMPILER_INIT}) |
8752
48cf2ccb83c6
with lot of hackery, use add_executable on pascal files, SUCCSS
koda
parents:
8750
diff
changeset
|
18 |
MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable FPC:\n$ENV{FPC}.") |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
19 |
ENDIF(EXISTS ${CMAKE_Pascal_COMPILER_INIT}) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
20 |
ENDIF($ENV{FPC} MATCHES ".+") |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
21 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
22 |
# next try prefer the compiler specified by the generator |
8752
48cf2ccb83c6
with lot of hackery, use add_executable on pascal files, SUCCSS
koda
parents:
8750
diff
changeset
|
23 |
IF(CMAKE_GENERATOR_PASCAL) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
24 |
IF(NOT CMAKE_Pascal_COMPILER_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
25 |
SET(CMAKE_Pascal_COMPILER_INIT ${CMAKE_GENERATOR_PASCAL}) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
26 |
ENDIF(NOT CMAKE_Pascal_COMPILER_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
27 |
ENDIF(CMAKE_GENERATOR_PASCAL) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
28 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
29 |
# finally list compilers to try |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
30 |
IF(CMAKE_Pascal_COMPILER_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
31 |
SET(CMAKE_Pascal_COMPILER_LIST ${CMAKE_Pascal_COMPILER_INIT}) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
32 |
ELSE(CMAKE_Pascal_COMPILER_INIT) |
8752
48cf2ccb83c6
with lot of hackery, use add_executable on pascal files, SUCCSS
koda
parents:
8750
diff
changeset
|
33 |
SET(CMAKE_Pascal_COMPILER_LIST fpc) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
34 |
ENDIF(CMAKE_Pascal_COMPILER_INIT) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
35 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
36 |
# Find the compiler. |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
37 |
FIND_PROGRAM(CMAKE_Pascal_COMPILER NAMES ${CMAKE_Pascal_COMPILER_LIST} DOC "Pascal compiler") |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
38 |
IF(CMAKE_Pascal_COMPILER_INIT AND NOT CMAKE_Pascal_COMPILER) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
39 |
SET(CMAKE_Pascal_COMPILER "${CMAKE_Pascal_COMPILER_INIT}" CACHE FILEPATH "Pascal compiler" FORCE) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
40 |
ENDIF(CMAKE_Pascal_COMPILER_INIT AND NOT CMAKE_Pascal_COMPILER) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
41 |
ENDIF(NOT CMAKE_Pascal_COMPILER) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
42 |
MARK_AS_ADVANCED(CMAKE_Pascal_COMPILER) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
43 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
44 |
GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_Pascal_COMPILER}" PATH) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
45 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
46 |
#FIND_PROGRAM(GNAT_EXECUTABLE_BUILDER NAMES gnatmake PATHS ${COMPILER_LOCATION} ) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
47 |
FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} ) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
48 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
49 |
FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
50 |
IF(NOT CMAKE_RANLIB) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
51 |
SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
52 |
ENDIF(NOT CMAKE_RANLIB) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
53 |
MARK_AS_ADVANCED(CMAKE_RANLIB) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
54 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
55 |
# configure variables set in this file for fast reload later on |
8764
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
56 |
if(${CMAKE_VERSION} VERSION_LESS 2.8.10) |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
57 |
CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakePascalCompiler.cmake.in |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
58 |
"${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakePascalCompiler.cmake" |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
59 |
IMMEDIATE ) |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
60 |
else(${CMAKE_VERSION} VERSION_LESS 2.8.10) |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
61 |
CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakePascalCompiler.cmake.in |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
62 |
"${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${CMAKE_VERSION}/CMakePascalCompiler.cmake" |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
63 |
IMMEDIATE ) |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
64 |
endif(${CMAKE_VERSION} VERSION_LESS 2.8.10) |
f16bcb3dba9e
the default CMake(Lang)Compiler.cmake location changed since 2.8.10
koda
parents:
8754
diff
changeset
|
65 |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
66 |
MARK_AS_ADVANCED(CMAKE_AR) |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
67 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
68 |
SET(CMAKE_Pascal_COMPILER_ENV_VAR "FPC") |