1 # This file sets the basic flags for the Pascal language in CMake. |
1 # This file sets the basic flags for the Pascal language in CMake. |
2 # It also loads the available platform file for the system-compiler |
2 # It also loads the available platform file for the system-compiler |
3 # if it exists. |
3 # if it exists. |
4 |
4 |
|
5 # in case fpc ever becomes included in cmake |
5 get_filename_component(CMAKE_BASE_NAME ${CMAKE_Pascal_COMPILER} NAME_WE) |
6 get_filename_component(CMAKE_BASE_NAME ${CMAKE_Pascal_COMPILER} NAME_WE) |
6 set(CMAKE_SYSTEM_AND_Pascal_COMPILER_INFO_FILE |
7 set(CMAKE_SYSTEM_AND_Pascal_COMPILER_INFO_FILE |
7 ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) |
8 ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) |
8 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) |
9 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) |
9 |
10 |
31 # For 90% of the systems, these are the same flags as the C versions |
32 # For 90% of the systems, these are the same flags as the C versions |
32 # so if these are not set just copy the flags from the c version |
33 # so if these are not set just copy the flags from the c version |
33 |
34 |
34 # No flags supported during linking as a shell script takes care of it |
35 # No flags supported during linking as a shell script takes care of it |
35 # however to avoid interferences we escape -Wl flags to the Pascal -k |
36 # however to avoid interferences we escape -Wl flags to the Pascal -k |
36 if(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS) |
37 #if(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS) |
37 #-shared |
38 #-shared (linux) / -dynamiclib -Wl,-headerpad_max_install_names (darwin) |
38 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) |
39 # string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) |
39 endif(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS) |
40 #endif(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS) |
40 |
41 |
41 if(NOT CMAKE_SHARED_LIBRARY_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_C_FLAGS) |
42 if(NOT CMAKE_SHARED_LIBRARY_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_C_FLAGS) |
|
43 #-fPIC |
42 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) |
44 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) |
43 endif() |
45 endif() |
44 |
46 |
45 if(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) |
47 if(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) |
46 #-rdynamic |
48 #-rdynamic (linux) / (empty on darwin) |
47 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) |
49 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) |
48 endif() |
50 endif() |
49 |
51 |
50 if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG) |
52 if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG) |
51 #-Wl,-rpath, |
53 #-Wl,-rpath, |
69 set(CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS}) |
71 set(CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS}) |
70 endif(NOT CMAKE_MODULE_EXISTS) |
72 endif(NOT CMAKE_MODULE_EXISTS) |
71 |
73 |
72 # repeat for modules |
74 # repeat for modules |
73 if(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS) |
75 if(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS) |
|
76 # ? (linux) / -bundle -Wl,-headerpad_max_install_names (darwin) |
74 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) |
77 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) |
75 endif(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS) |
78 endif(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS) |
76 |
79 |
77 if(NOT CMAKE_SHARED_MODULE_Pascal_FLAGS AND CMAKE_SHARED_MODULE_C_FLAGS) |
80 if(NOT CMAKE_SHARED_MODULE_Pascal_FLAGS AND CMAKE_SHARED_MODULE_C_FLAGS) |
78 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) |
81 string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) |
84 |
87 |
85 if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP) |
88 if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP) |
86 set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) |
89 set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) |
87 endif(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP) |
90 endif(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP) |
88 |
91 |
|
92 # now other system things |
89 if(NOT CMAKE_INCLUDE_FLAG_Pascal) |
93 if(NOT CMAKE_INCLUDE_FLAG_Pascal) |
90 #amazing, fpc: -I<x> Add <x> to include path |
94 #amazing, fpc: -I<x> Add <x> to include path |
91 set(CMAKE_INCLUDE_FLAG_Pascal ${CMAKE_INCLUDE_FLAG_C}) |
95 set(CMAKE_INCLUDE_FLAG_Pascal ${CMAKE_INCLUDE_FLAG_C}) |
92 endif(NOT CMAKE_INCLUDE_FLAG_Pascal) |
96 endif(NOT CMAKE_INCLUDE_FLAG_Pascal) |
93 |
97 |
95 set(CMAKE_INCLUDE_FLAG_SEP_Pascal ${CMAKE_INCLUDE_FLAG_SEP_C}) |
99 set(CMAKE_INCLUDE_FLAG_SEP_Pascal ${CMAKE_INCLUDE_FLAG_SEP_C}) |
96 endif(NOT CMAKE_INCLUDE_FLAG_SEP_Pascal) |
100 endif(NOT CMAKE_INCLUDE_FLAG_SEP_Pascal) |
97 |
101 |
98 # Copy C version of this flag which is normally determined in platform file. |
102 # Copy C version of this flag which is normally determined in platform file. |
99 if(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG) |
103 if(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG) |
|
104 #-soname (linux) / -install-name (dawin) |
100 set(CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) |
105 set(CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) |
101 endif(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG) |
106 endif(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG) |
102 |
107 |
103 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.") |
108 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.") |
104 |
109 |