cmake_modules/CMakeDeterminePascalCompiler.cmake
branchcmake_pascal
changeset 8752 48cf2ccb83c6
parent 8750 d9e57426e759
child 8754 0c08d07e791a
equal deleted inserted replaced
8750:d9e57426e759 8752:48cf2ccb83c6
     1 # Determine the compiler to use for Pascal programs
     1 # Determine the compiler to use for Pascal programs
     2 # NOTE, a generator may set CMAKE_Pascal_COMPILER before
     2 # NOTE, a generator may set CMAKE_Pascal_COMPILER before
     3 # loading this file to force a compiler.
     3 # loading this file to force a compiler.
     4 # use environment variable Pascal first if defined by user, next use 
     4 # use environment variable Pascal first if defined by user, next use
     5 # the cmake variable CMAKE_GENERATOR_PASCAL which can be defined by a generator
     5 # the cmake variable CMAKE_GENERATOR_PASCAL which can be defined by a generator
     6 # as a default compiler
     6 # as a default compiler
     7 
     7 
     8 IF(NOT CMAKE_Pascal_COMPILER)
     8 IF(NOT CMAKE_Pascal_COMPILER)
     9 
     9 
    13     IF(CMAKE_Pascal_FLAGS_ENV_INIT)
    13     IF(CMAKE_Pascal_FLAGS_ENV_INIT)
    14       SET(CMAKE_Pascal_COMPILER_ARG1 "${CMAKE_Pascal_FLAGS_ENV_INIT}" CACHE STRING "First argument to Pascal compiler")
    14       SET(CMAKE_Pascal_COMPILER_ARG1 "${CMAKE_Pascal_FLAGS_ENV_INIT}" CACHE STRING "First argument to Pascal compiler")
    15     ENDIF(CMAKE_Pascal_FLAGS_ENV_INIT)
    15     ENDIF(CMAKE_Pascal_FLAGS_ENV_INIT)
    16     IF(EXISTS ${CMAKE_Pascal_COMPILER_INIT})
    16     IF(EXISTS ${CMAKE_Pascal_COMPILER_INIT})
    17     ELSE(EXISTS ${CMAKE_Pascal_COMPILER_INIT})
    17     ELSE(EXISTS ${CMAKE_Pascal_COMPILER_INIT})
    18       MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable FPC:\n$ENV{FPC}.") 
    18       MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable FPC:\n$ENV{FPC}.")
    19     ENDIF(EXISTS ${CMAKE_Pascal_COMPILER_INIT})
    19     ENDIF(EXISTS ${CMAKE_Pascal_COMPILER_INIT})
    20   ENDIF($ENV{FPC} MATCHES ".+")
    20   ENDIF($ENV{FPC} MATCHES ".+")
    21 
    21 
    22   # next try prefer the compiler specified by the generator
    22   # next try prefer the compiler specified by the generator
    23   IF(CMAKE_GENERATOR_PASCAL) 
    23   IF(CMAKE_GENERATOR_PASCAL)
    24     IF(NOT CMAKE_Pascal_COMPILER_INIT)
    24     IF(NOT CMAKE_Pascal_COMPILER_INIT)
    25       SET(CMAKE_Pascal_COMPILER_INIT ${CMAKE_GENERATOR_PASCAL})
    25       SET(CMAKE_Pascal_COMPILER_INIT ${CMAKE_GENERATOR_PASCAL})
    26     ENDIF(NOT CMAKE_Pascal_COMPILER_INIT)
    26     ENDIF(NOT CMAKE_Pascal_COMPILER_INIT)
    27   ENDIF(CMAKE_GENERATOR_PASCAL)
    27   ENDIF(CMAKE_GENERATOR_PASCAL)
    28 
    28 
    29   # finally list compilers to try
    29   # finally list compilers to try
    30   IF(CMAKE_Pascal_COMPILER_INIT)
    30   IF(CMAKE_Pascal_COMPILER_INIT)
    31     SET(CMAKE_Pascal_COMPILER_LIST ${CMAKE_Pascal_COMPILER_INIT})
    31     SET(CMAKE_Pascal_COMPILER_LIST ${CMAKE_Pascal_COMPILER_INIT})
    32   ELSE(CMAKE_Pascal_COMPILER_INIT)
    32   ELSE(CMAKE_Pascal_COMPILER_INIT)
    33     SET(CMAKE_Pascal_COMPILER_LIST fpc ppc386 ppcx64 ppcppc ppcarm)  
    33     SET(CMAKE_Pascal_COMPILER_LIST fpc)
    34   ENDIF(CMAKE_Pascal_COMPILER_INIT)
    34   ENDIF(CMAKE_Pascal_COMPILER_INIT)
    35 
    35 
    36   # Find the compiler.
    36   # Find the compiler.
    37   FIND_PROGRAM(CMAKE_Pascal_COMPILER NAMES ${CMAKE_Pascal_COMPILER_LIST} DOC "Pascal compiler")
    37   FIND_PROGRAM(CMAKE_Pascal_COMPILER NAMES ${CMAKE_Pascal_COMPILER_LIST} DOC "Pascal compiler")
    38   IF(CMAKE_Pascal_COMPILER_INIT AND NOT CMAKE_Pascal_COMPILER)
    38   IF(CMAKE_Pascal_COMPILER_INIT AND NOT CMAKE_Pascal_COMPILER)
    51    SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
    51    SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
    52 ENDIF(NOT CMAKE_RANLIB)
    52 ENDIF(NOT CMAKE_RANLIB)
    53 MARK_AS_ADVANCED(CMAKE_RANLIB)
    53 MARK_AS_ADVANCED(CMAKE_RANLIB)
    54 
    54 
    55 # configure variables set in this file for fast reload later on
    55 # configure variables set in this file for fast reload later on
    56 #CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakePascalCompiler.cmake.in 
    56 #CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakePascalCompiler.cmake.in
    57 CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakePascalCompiler.cmake.in 
    57 CONFIGURE_FILE(${CMAKE_MODULE_PATH}/CMakePascalCompiler.cmake.in
    58                "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${CMAKE_VERSION}/CMakePascalCompiler.cmake"
    58                "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${CMAKE_VERSION}/CMakePascalCompiler.cmake"
    59                IMMEDIATE)
    59                IMMEDIATE)
    60 MARK_AS_ADVANCED(CMAKE_AR)
    60 MARK_AS_ADVANCED(CMAKE_AR)
    61 
    61 
    62 SET(CMAKE_Pascal_COMPILER_ENV_VAR "FPC")
    62 SET(CMAKE_Pascal_COMPILER_ENV_VAR "FPC")