cmake_modules/CMakePascalInformation.cmake
author koda
Mon, 08 Jul 2013 12:10:55 +0200
changeset 9339 14f5f3a1e2f7
parent 9227 c02e081ba481
child 9341 4dfebad83d51
permissions -rw-r--r--
some work on cmake_pascal files to better support flags we use, make engine compile as library again
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
     5
get_filename_component(CMAKE_BASE_NAME ${CMAKE_Pascal_COMPILER} NAME_WE)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
     6
set(CMAKE_SYSTEM_AND_Pascal_COMPILER_INFO_FILE
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
     7
    ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
     8
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
     9
8821
e85ff6e298b5 adjust verbosity, move debug/release variables in the right section
koda
parents: 8815
diff changeset
    10
# This section should actually be in Platform/${CMAKE_SYSTME_NAME}-fpc.cmake
e85ff6e298b5 adjust verbosity, move debug/release variables in the right section
koda
parents: 8815
diff changeset
    11
set(CMAKE_Pascal_FLAGS_INIT "-l- -v0ewn")
e85ff6e298b5 adjust verbosity, move debug/release variables in the right section
koda
parents: 8815
diff changeset
    12
set(CMAKE_Pascal_FLAGS_DEBUG_INIT "-g -gl -gp -gh")
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")
e85ff6e298b5 adjust verbosity, move debug/release variables in the right section
koda
parents: 8815
diff changeset
    14
set(CMAKE_Pascal_FLAGS_RELEASE_INIT "-O3 -dNDEBUG")
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
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    23
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    24
   include(${CMAKE_USER_MAKE_RULES_OVERRIDE})
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    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
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    27
if(CMAKE_USER_MAKE_RULES_OVERRIDE_Pascal)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    28
   include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Pascal})
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    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
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
    34
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
    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
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    37
if(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS)
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
    38
#-shared
14f5f3a1e2f7 some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents: 9227
diff changeset
    39
    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    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)
14f5f3a1e2f7 some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents: 9227
diff changeset
    43
    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
    44
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
    45
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
if(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS AND 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
    47
#-rdynamic
14f5f3a1e2f7 some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents: 9227
diff changeset
    48
    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
    49
endif()
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    50
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
    51
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
    52
#-Wl,-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
    53
    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_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
    54
    string(REGEX REPLACE "," "" CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG ${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
    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,
14f5f3a1e2f7 some work on cmake_pascal files to better support flags we use, make engine compile as library again
koda
parents: 9227
diff changeset
    63
    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
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
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    70
    set(CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_Pascal_FLAGS})
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    71
    set(CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS})
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    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
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    75
if(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS)
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
    76
    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    77
endif(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS)
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    78
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
    79
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
    80
    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
    81
endif()
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    82
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    83
if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG)
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    84
    set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG})
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    85
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
    86
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    87
if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP)
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    88
    set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP})
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
    89
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
    90
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    91
if(NOT CMAKE_INCLUDE_FLAG_Pascal)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    92
    #amazing, fpc: -I<x>  Add <x> to include path
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    93
    set(CMAKE_INCLUDE_FLAG_Pascal ${CMAKE_INCLUDE_FLAG_C})
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    94
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
    95
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    96
if(NOT CMAKE_INCLUDE_FLAG_SEP_Pascal)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    97
    set(CMAKE_INCLUDE_FLAG_SEP_Pascal ${CMAKE_INCLUDE_FLAG_SEP_C})
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
    98
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
    99
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   100
# Copy C version of this flag which is normally determined in platform file.
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   101
if(NOT CMAKE_SHARED_LIBRARY_SONAME_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
   102
    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   103
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
   104
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   105
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
   106
9227
c02e081ba481 this should resolve a few issues on clean builds
koda
parents: 8863
diff changeset
   107
set(CMAKE_Pascal_FLAGS "$ENV{FPFLAGS} ${CMAKE_Pascal_FLAGS_INIT} ${CMAKE_Pascal_FLAGS}" CACHE STRING "Flags for Pascal compiler.")
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   108
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   109
include(CMakeCommonLanguageInclude)
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   110
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   111
# 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
   112
8831
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   113
# CMAKE_Pascal_CREATE_SHARED_LIBRARY
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   114
# CMAKE_Pascal_CREATE_SHARED_MODULE
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   115
# CMAKE_Pascal_CREATE_STATIC_LIBRARY
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   116
# CMAKE_Pascal_COMPILE_OBJECT
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   117
# CMAKE_Pascal_LINK_EXECUTABLE
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
# 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
   120
# <TARGET>
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   121
# <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
   122
# <OBJECTS>
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   123
# <OBJECT>
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   124
# <LINK_LIBRARIES>
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   125
# <FLAGS>
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   126
# <LINK_FLAGS>
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   127
8831
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   128
# Pascal compiler information
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   129
# <CMAKE_Pascal_COMPILER>
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   130
# <CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS>
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   131
# <CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS>
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   132
# <CMAKE_Pascal_LINK_FLAGS>
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   133
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   134
# Static library tools
8834
edceeafff671 no need of ar and ranlib for pascal
koda
parents: 8831
diff changeset
   135
#  NONE!
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   136
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   137
if(NOT EXECUTABLE_OUTPUT_PATH)
8756
671f6ef4f7f1 move paths setup inside cmake_lang files
koda
parents: 8754
diff changeset
   138
    set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   139
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
   140
8823
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   141
# create a Pascal shared library
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   142
if(NOT CMAKE_Pascal_CREATE_SHARED_LIBRARY)
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   143
    if(WIN32)
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   144
        set(CMAKE_Pascal_CREATE_SHARED_LIBRARY "${EXECUTABLE_OUTPUT_PATH}/ppas.bat")
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   145
    else(WIN32)
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   146
        set(CMAKE_Pascal_CREATE_SHARED_LIBRARY "${EXECUTABLE_OUTPUT_PATH}/ppas.sh")
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   147
    endif(WIN32)
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   148
# 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>
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   149
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
   150
8831
06562cd68897 finish off by replacing remaining Ada occurencies
koda
parents: 8829
diff changeset
   151
# create an Pascal shared module just copy the shared library rule
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   152
if(NOT CMAKE_Pascal_CREATE_SHARED_MODULE)
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   153
  set(CMAKE_Pascal_CREATE_SHARED_MODULE ${CMAKE_Pascal_CREATE_SHARED_LIBRARY})
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   154
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
   155
8829
6940e86a7df6 disable static libraries with fpc
koda
parents: 8823
diff changeset
   156
# create an Pascal static library (unsupported)
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   157
if(NOT CMAKE_Pascal_CREATE_STATIC_LIBRARY)
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   158
  set(CMAKE_Pascal_CREATE_STATIC_LIBRARY
8829
6940e86a7df6 disable static libraries with fpc
koda
parents: 8823
diff changeset
   159
      "echo STATIC LIBRARIES ARE NOT SUPPORTED" "exit")
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   160
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
   161
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
   162
# compile a Pascal file into an object file
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   163
if(NOT CMAKE_Pascal_COMPILE_OBJECT)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   164
    if(UNIX)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   165
        #when you have multiple ld installation make sure you get the one bundled with the system C compiler
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   166
        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
   167
        if(CMAKE_COMPILER_IS_GNUCC)
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   168
            get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} PATH)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   169
            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
   170
        endif(CMAKE_COMPILER_IS_GNUCC)
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   171
        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
   172
            #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
   173
        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
   174
            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
   175
                #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
   176
                #\\\\ 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
   177
                #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
   178
                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
   179
                #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
   180
                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
   181
            endif()
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   182
        endif(APPLE)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   183
    endif(UNIX)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   184
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
   185
    #-Cn is mandatory as it's what creates the ppas.* script
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   186
    set(CMAKE_Pascal_COMPILE_OBJECT
8846
c156ac6ddc2b set directories to be included externally, in the project file
koda
parents: 8834
diff changeset
   187
        "<CMAKE_Pascal_COMPILER> -Cn -FE${EXECUTABLE_OUTPUT_PATH} -FU${CMAKE_CURRENT_BINARY_DIR}/<OBJECT_DIR> ${CMAKE_Pascal_UNIX_FLAGS} <FLAGS> <SOURCE>")
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   188
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
   189
8778
04363016580f internal handling of some osx-only pascal flags
koda
parents: 8770
diff changeset
   190
# link Pascal objects in a single executable
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   191
if(NOT CMAKE_Pascal_LINK_EXECUTABLE)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   192
    if(WIN32)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   193
        set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.bat")
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   194
    else(WIN32)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   195
        set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.sh")
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   196
    endif(WIN32)
8823
65b430b6cd68 add support for creating shared pascal libraries
koda
parents: 8821
diff changeset
   197
# other expandable variables here are <CMAKE_Pascal_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE> <FLAGS> <LINK_LIBRARIES>
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   198
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
   199
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   200
if(CMAKE_Pascal_STANDARD_LIBRARIES_INIT)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   201
    set(CMAKE_Pascal_STANDARD_LIBRARIES "${CMAKE_Pascal_STANDARD_LIBRARIES_INIT}"
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   202
    CACHE STRING "Libraries linked by default (usually handled internally).")
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   203
    mark_as_advanced(CMAKE_Pascal_STANDARD_LIBRARIES)
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   204
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
   205
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   206
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
8859
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   207
    set(CMAKE_Pascal_FLAGS_DEBUG "${CMAKE_Pascal_FLAGS_DEBUG_INIT}" CACHE STRING
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   208
        "Flags used by the compiler during debug builds.")
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   209
    set(CMAKE_Pascal_FLAGS_MINSIZEREL "${CMAKE_Pascal_FLAGS_MINSIZEREL_INIT}" CACHE STRING
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   210
        "Flags used by the compiler during release minsize builds.")
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   211
    set(CMAKE_Pascal_FLAGS_RELEASE "${CMAKE_Pascal_FLAGS_RELEASE_INIT}" CACHE STRING
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   212
        "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   213
    set(CMAKE_Pascal_FLAGS_RELWITHDEBINFO "${CMAKE_Pascal_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
bead90828a94 cmake netiquette
koda
parents: 8846
diff changeset
   214
        "Flags used by the compiler during Release with Debug Info builds.")
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   215
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
   216
8815
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   217
mark_as_advanced(CMAKE_Pascal_FLAGS CMAKE_Pascal_FLAGS_DEBUG CMAKE_Pascal_FLAGS_MINSIZEREL
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   218
                 CMAKE_Pascal_FLAGS_RELEASE CMAKE_Pascal_FLAGS_RELWITHDEBINFO)
c28fcd8ec138 minor and partial casing commit
koda
parents: 8809
diff changeset
   219
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
   220