author | Wuzzy <almikes@aol.com> |
Sat, 23 Sep 2017 06:47:13 +0200 | |
changeset 12502 | 4820afae2935 |
parent 9950 | 2759212a27de |
child 13924 | 085ed3ff0637 |
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 |
# This file sets the basic flags for the Pascal language in CMake. |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
2 |
# It also loads the available platform file for the system-compiler |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
3 |
# if it exists. |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
4 |
|
9513 | 5 |
# in case fpc ever becomes included in cmake |
8815 | 6 |
get_filename_component(CMAKE_BASE_NAME ${CMAKE_Pascal_COMPILER} NAME_WE) |
7 |
set(CMAKE_SYSTEM_AND_Pascal_COMPILER_INFO_FILE |
|
8 |
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) |
|
9 |
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
10 |
|
8821
e85ff6e298b5
adjust verbosity, move debug/release variables in the right section
koda
parents:
8815
diff
changeset
|
11 |
# This section should actually be in Platform/${CMAKE_SYSTME_NAME}-fpc.cmake |
9886 | 12 |
set(CMAKE_Pascal_FLAGS_DEBUG_INIT "-O- -g -gl -gp -gh") |
8821
e85ff6e298b5
adjust verbosity, move debug/release variables in the right section
koda
parents:
8815
diff
changeset
|
13 |
set(CMAKE_Pascal_FLAGS_MINSIZEREL_INIT "-Os -dNDEBUG") |
9869 | 14 |
set(CMAKE_Pascal_FLAGS_RELEASE_INIT "-O2 -dNDEBUG") |
8821
e85ff6e298b5
adjust verbosity, move debug/release variables in the right section
koda
parents:
8815
diff
changeset
|
15 |
set(CMAKE_Pascal_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -gl -gp") |
e85ff6e298b5
adjust verbosity, move debug/release variables in the right section
koda
parents:
8815
diff
changeset
|
16 |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
17 |
# This should be included before the _INIT variables are |
8821
e85ff6e298b5
adjust verbosity, move debug/release variables in the right section
koda
parents:
8815
diff
changeset
|
18 |
# used to initialize the cache. Since the rule variables |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
19 |
# have if blocks on them, users can still define them here. |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
20 |
# But, it should still be after the platform file so changes can |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
21 |
# be made to those values. |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
22 |
|
8815 | 23 |
if(CMAKE_USER_MAKE_RULES_OVERRIDE) |
24 |
include(${CMAKE_USER_MAKE_RULES_OVERRIDE}) |
|
25 |
endif(CMAKE_USER_MAKE_RULES_OVERRIDE) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
26 |
|
8815 | 27 |
if(CMAKE_USER_MAKE_RULES_OVERRIDE_Pascal) |
28 |
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Pascal}) |
|
29 |
endif(CMAKE_USER_MAKE_RULES_OVERRIDE_Pascal) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
30 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
31 |
# Create a set of shared library variable specific to Pascal |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
32 |
# For 90% of the systems, these are the same flags as the C versions |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
33 |
# so if these are not set just copy the flags from the c version |
8831 | 34 |
|
35 |
# No flags supported during linking as a shell script takes care of it |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
36 |
# however to avoid interferences we escape -Wl flags to the Pascal -k |
9513 | 37 |
#if(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS) |
38 |
#-shared (linux) / -dynamiclib -Wl,-headerpad_max_install_names (darwin) |
|
39 |
# string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) |
|
40 |
#endif(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
41 |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
42 |
if(NOT CMAKE_SHARED_LIBRARY_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_C_FLAGS) |
9513 | 43 |
#-fPIC |
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
44 |
string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
45 |
endif() |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
46 |
|
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
47 |
if(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) |
9513 | 48 |
#-rdynamic (linux) / (empty on darwin) |
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
49 |
string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
50 |
endif() |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
51 |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
52 |
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
53 |
#-Wl,-rpath, |
9341 | 54 |
set(CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG "-k-rpath") |
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
55 |
endif(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
56 |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
57 |
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
58 |
set(CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
59 |
endif(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
60 |
|
8770
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
61 |
if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG) |
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
62 |
#-Wl,-rpath-link, |
9415
276f6d7d9e2e
fix shared library loading by using the right variable
koda
parents:
9413
diff
changeset
|
63 |
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG "-k-rpath-link") |
8770
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
64 |
endif(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG) |
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
65 |
|
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
66 |
# for most systems a module is the same as a shared library |
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
67 |
# so unless the variable CMAKE_MODULE_EXISTS is set just |
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
68 |
# copy the values from the LIBRARY variables |
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
69 |
if(NOT CMAKE_MODULE_EXISTS) |
8815 | 70 |
set(CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_Pascal_FLAGS}) |
71 |
set(CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS}) |
|
72 |
endif(NOT CMAKE_MODULE_EXISTS) |
|
8770
53481d654691
partial conversion of pascal_flags to CMAKE_Pascal_FLAGS
koda
parents:
8758
diff
changeset
|
73 |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
74 |
# repeat for modules |
9521
8054d9d775fd
merge with latest defaul, fixing compiling with fpc, parsing and rendering with pas2c, some minor problems with compiling with clang
koda
parents:
9515
diff
changeset
|
75 |
if(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS AND CMAKE_SHARED_MODULE_CREATE_C_FLAGS) |
9513 | 76 |
# ? (linux) / -bundle -Wl,-headerpad_max_install_names (darwin) |
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
77 |
string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) |
9521
8054d9d775fd
merge with latest defaul, fixing compiling with fpc, parsing and rendering with pas2c, some minor problems with compiling with clang
koda
parents:
9515
diff
changeset
|
78 |
endif() |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
79 |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
80 |
if(NOT CMAKE_SHARED_MODULE_Pascal_FLAGS AND CMAKE_SHARED_MODULE_C_FLAGS) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
81 |
string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
82 |
endif() |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
83 |
|
8859 | 84 |
if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG) |
85 |
set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) |
|
86 |
endif(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
87 |
|
8859 | 88 |
if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP) |
89 |
set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) |
|
90 |
endif(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
91 |
|
9513 | 92 |
# now other system things |
8815 | 93 |
if(NOT CMAKE_INCLUDE_FLAG_Pascal) |
94 |
#amazing, fpc: -I<x> Add <x> to include path |
|
95 |
set(CMAKE_INCLUDE_FLAG_Pascal ${CMAKE_INCLUDE_FLAG_C}) |
|
96 |
endif(NOT CMAKE_INCLUDE_FLAG_Pascal) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
97 |
|
8815 | 98 |
if(NOT CMAKE_INCLUDE_FLAG_SEP_Pascal) |
99 |
set(CMAKE_INCLUDE_FLAG_SEP_Pascal ${CMAKE_INCLUDE_FLAG_SEP_C}) |
|
100 |
endif(NOT CMAKE_INCLUDE_FLAG_SEP_Pascal) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
101 |
|
9515
9af6176fcd8f
set the correct framework search path for freepascal on darwin, targetting future cmake releases
koda
parents:
9513
diff
changeset
|
102 |
if(NOT CMAKE_Pascal_FRAMEWORK_SEARCH_FLAG) |
9af6176fcd8f
set the correct framework search path for freepascal on darwin, targetting future cmake releases
koda
parents:
9513
diff
changeset
|
103 |
#however -F won't work, -Ff is Pascal equivalent |
9af6176fcd8f
set the correct framework search path for freepascal on darwin, targetting future cmake releases
koda
parents:
9513
diff
changeset
|
104 |
set(CMAKE_Pascal_FRAMEWORK_SEARCH_FLAG "-Ff") |
9af6176fcd8f
set the correct framework search path for freepascal on darwin, targetting future cmake releases
koda
parents:
9513
diff
changeset
|
105 |
endif(NOT CMAKE_Pascal_FRAMEWORK_SEARCH_FLAG) |
9af6176fcd8f
set the correct framework search path for freepascal on darwin, targetting future cmake releases
koda
parents:
9513
diff
changeset
|
106 |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
107 |
# Copy C version of this flag which is normally determined in platform file. |
8815 | 108 |
if(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG) |
9513 | 109 |
#-soname (linux) / -install-name (dawin) |
9341 | 110 |
set(CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) |
8815 | 111 |
endif(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
112 |
|
8815 | 113 |
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
114 |
|
9413
37fcb9a796e6
this should prevent duplication of CMAKE_Pascal_FLAGS
koda
parents:
9348
diff
changeset
|
115 |
#set(CMAKE_Pascal_FLAGS "$ENV{FPFLAGS} ${CMAKE_Pascal_FLAGS_INIT} ${CMAKE_Pascal_FLAGS}" CACHE STRING "Flags for Pascal compiler." FORCE) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
116 |
|
8859 | 117 |
include(CMakeCommonLanguageInclude) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
118 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
119 |
# now define the following rule variables |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
120 |
|
8831 | 121 |
# CMAKE_Pascal_CREATE_SHARED_LIBRARY |
122 |
# CMAKE_Pascal_CREATE_SHARED_MODULE |
|
123 |
# CMAKE_Pascal_CREATE_STATIC_LIBRARY |
|
124 |
# CMAKE_Pascal_COMPILE_OBJECT |
|
125 |
# CMAKE_Pascal_LINK_EXECUTABLE |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
126 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
127 |
# variables supplied by the generator at use time |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
128 |
# <TARGET> |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
129 |
# <TARGET_BASE> the target without the suffix |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
130 |
# <OBJECTS> |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
131 |
# <OBJECT> |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
132 |
# <LINK_LIBRARIES> |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
133 |
# <FLAGS> |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
134 |
# <LINK_FLAGS> |
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
135 |
|
8831 | 136 |
# Pascal compiler information |
137 |
# <CMAKE_Pascal_COMPILER> |
|
138 |
# <CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS> |
|
139 |
# <CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS> |
|
140 |
# <CMAKE_Pascal_LINK_FLAGS> |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
141 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
142 |
# Static library tools |
8834 | 143 |
# NONE! |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
144 |
|
8815 | 145 |
if(NOT EXECUTABLE_OUTPUT_PATH) |
8756 | 146 |
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) |
8815 | 147 |
endif(NOT EXECUTABLE_OUTPUT_PATH) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
148 |
|
8823 | 149 |
# create a Pascal shared library |
150 |
if(NOT CMAKE_Pascal_CREATE_SHARED_LIBRARY) |
|
151 |
if(WIN32) |
|
152 |
set(CMAKE_Pascal_CREATE_SHARED_LIBRARY "${EXECUTABLE_OUTPUT_PATH}/ppas.bat") |
|
153 |
else(WIN32) |
|
154 |
set(CMAKE_Pascal_CREATE_SHARED_LIBRARY "${EXECUTABLE_OUTPUT_PATH}/ppas.sh") |
|
155 |
endif(WIN32) |
|
156 |
# other expandable variables here are <CMAKE_Pascal_COMPILER> <CMAKE_SHARED_LIBRARY_Pascal_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG> <TARGET_SONAME> <TARGET> <OBJECTS> <LINK_LIBRARIES> |
|
157 |
endif(NOT CMAKE_Pascal_CREATE_SHARED_LIBRARY) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
158 |
|
8831 | 159 |
# create an Pascal shared module just copy the shared library rule |
8859 | 160 |
if(NOT CMAKE_Pascal_CREATE_SHARED_MODULE) |
161 |
set(CMAKE_Pascal_CREATE_SHARED_MODULE ${CMAKE_Pascal_CREATE_SHARED_LIBRARY}) |
|
162 |
endif(NOT CMAKE_Pascal_CREATE_SHARED_MODULE) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
163 |
|
8829 | 164 |
# create an Pascal static library (unsupported) |
8859 | 165 |
if(NOT CMAKE_Pascal_CREATE_STATIC_LIBRARY) |
166 |
set(CMAKE_Pascal_CREATE_STATIC_LIBRARY |
|
8829 | 167 |
"echo STATIC LIBRARIES ARE NOT SUPPORTED" "exit") |
8859 | 168 |
endif(NOT CMAKE_Pascal_CREATE_STATIC_LIBRARY) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
169 |
|
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
170 |
# compile a Pascal file into an object file |
8815 | 171 |
if(NOT CMAKE_Pascal_COMPILE_OBJECT) |
172 |
if(UNIX) |
|
173 |
#when you have multiple ld installation make sure you get the one bundled with the system C compiler |
|
174 |
include(Platform/${CMAKE_SYSTEM_NAME}-GNU-C.cmake OPTIONAL) |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
175 |
if(CMAKE_COMPILER_IS_GNUCC) |
8815 | 176 |
get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} PATH) |
177 |
set(CMAKE_Pascal_UNIX_FLAGS "-FD${CMAKE_C_COMPILER_DIR}") |
|
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
178 |
endif(CMAKE_COMPILER_IS_GNUCC) |
8815 | 179 |
if(APPLE) |
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
180 |
#TODO: take care of CMAKE_INSTALL_NAME_DIR for shared targets |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
181 |
else(APPLE) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
182 |
if(CMAKE_INSTALL_RPATH) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
183 |
#need to escape twice because we use a script to link |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
184 |
#\\\\ is just \\ which escapes '\' in the final script |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
185 |
#same for $$ which escapes '$' in cmake |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
186 |
string(REGEX REPLACE "\\$" "\\\\$$" CMAKE_INSTALL_RPATH_ESCAPED ${CMAKE_INSTALL_RPATH}) |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
187 |
#normally this flag is found in <LINK_LIBRARIES> but that's not active here |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
188 |
set(CMAKE_Pascal_UNIX_FLAGS "${CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG} -k'${CMAKE_INSTALL_RPATH_ESCAPED}' ${CMAKE_Pascal_UNIX_FLAGS}") |
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
189 |
endif() |
8815 | 190 |
endif(APPLE) |
191 |
endif(UNIX) |
|
192 |
||
9339
14f5f3a1e2f7
some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents:
9227
diff
changeset
|
193 |
#-Cn is mandatory as it's what creates the ppas.* script |
8815 | 194 |
set(CMAKE_Pascal_COMPILE_OBJECT |
9417
a0d014328165
make sure that linker flags are picked by the pascal rule
koda
parents:
9415
diff
changeset
|
195 |
"<CMAKE_Pascal_COMPILER> -Cn -FE${EXECUTABLE_OUTPUT_PATH} -FU${CMAKE_CURRENT_BINARY_DIR}/<OBJECT_DIR> ${CMAKE_Pascal_UNIX_FLAGS} <FLAGS> <CMAKE_Pascal_LINK_FLAGS> <SOURCE>") |
8815 | 196 |
endif(NOT CMAKE_Pascal_COMPILE_OBJECT) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
197 |
|
8778 | 198 |
# link Pascal objects in a single executable |
8815 | 199 |
if(NOT CMAKE_Pascal_LINK_EXECUTABLE) |
200 |
if(WIN32) |
|
201 |
set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.bat") |
|
202 |
else(WIN32) |
|
203 |
set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.sh") |
|
204 |
endif(WIN32) |
|
8823 | 205 |
# other expandable variables here are <CMAKE_Pascal_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE> <FLAGS> <LINK_LIBRARIES> |
8815 | 206 |
endif(NOT CMAKE_Pascal_LINK_EXECUTABLE) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
207 |
|
8815 | 208 |
if(CMAKE_Pascal_STANDARD_LIBRARIES_INIT) |
209 |
set(CMAKE_Pascal_STANDARD_LIBRARIES "${CMAKE_Pascal_STANDARD_LIBRARIES_INIT}" |
|
210 |
CACHE STRING "Libraries linked by default (usually handled internally).") |
|
8859 | 211 |
mark_as_advanced(CMAKE_Pascal_STANDARD_LIBRARIES) |
8815 | 212 |
endif(CMAKE_Pascal_STANDARD_LIBRARIES_INIT) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
213 |
|
8815 | 214 |
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) |
8859 | 215 |
set(CMAKE_Pascal_FLAGS_DEBUG "${CMAKE_Pascal_FLAGS_DEBUG_INIT}" CACHE STRING |
216 |
"Flags used by the compiler during debug builds.") |
|
217 |
set(CMAKE_Pascal_FLAGS_MINSIZEREL "${CMAKE_Pascal_FLAGS_MINSIZEREL_INIT}" CACHE STRING |
|
218 |
"Flags used by the compiler during release minsize builds.") |
|
219 |
set(CMAKE_Pascal_FLAGS_RELEASE "${CMAKE_Pascal_FLAGS_RELEASE_INIT}" CACHE STRING |
|
220 |
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") |
|
221 |
set(CMAKE_Pascal_FLAGS_RELWITHDEBINFO "${CMAKE_Pascal_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING |
|
222 |
"Flags used by the compiler during Release with Debug Info builds.") |
|
8815 | 223 |
endif(NOT CMAKE_NOT_USING_CONFIG_FLAGS) |
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
224 |
|
8815 | 225 |
mark_as_advanced(CMAKE_Pascal_FLAGS CMAKE_Pascal_FLAGS_DEBUG CMAKE_Pascal_FLAGS_MINSIZEREL |
226 |
CMAKE_Pascal_FLAGS_RELEASE CMAKE_Pascal_FLAGS_RELWITHDEBINFO) |
|
227 |
set(CMAKE_Pascal_INFORMATION_LOADED 1) |
|
8750
d9e57426e759
barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff
changeset
|
228 |