cmake_modules/CMakeTestPascalCompiler.cmake
author unc0rr
Sun, 12 Jan 2014 15:15:59 +0400
changeset 9973 7589978c9912
parent 8866 26424c644306
permissions -rw-r--r--
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
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 is used by EnableLanguage in cmGlobalGenerator to determine that
8758
cb3b470f1000 better support for cmake directory and fpc output paths
koda
parents: 8754
diff changeset
     2
# the FreePascal can actually compile and link the most basic of programs.
cb3b470f1000 better support for cmake directory and fpc output paths
koda
parents: 8754
diff changeset
     3
# If not, a fatal error is set, cmake stops processing commands and will not
cb3b470f1000 better support for cmake directory and fpc output paths
koda
parents: 8754
diff changeset
     4
# generate any makefiles or projects.
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
     5
8859
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
     6
if(NOT CMAKE_Pascal_COMPILER_WORKS)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
     7
    message(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER}")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
     8
    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/testpascalcompiler.pas
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
     9
         "program testPascalCompiler;
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    10
          begin
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    11
          end.
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    12
         ")
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    13
8859
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    14
    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    15
         "set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    16
          set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL \"\" FORCE)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    17
          project(test Pascal)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    18
          add_executable(testpascalcompiler testpascalcompiler.pas)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    19
         ")
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    20
8758
cb3b470f1000 better support for cmake directory and fpc output paths
koda
parents: 8754
diff changeset
    21
# To avoid try_compile recurse error, use any binary directory other
cb3b470f1000 better support for cmake directory and fpc output paths
koda
parents: 8754
diff changeset
    22
# than ${CMAKE_BINARY_DIR}. The choice of
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    23
# bindir = ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp is
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    24
# especially advantageous since it makes an in-source build which
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    25
# means that no special variables need to be set to find files.
8859
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    26
    try_compile(CMAKE_Pascal_COMPILER_WORKS
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    27
                ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    28
                ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp
8866
26424c644306 this makes Xcode generator test pass
koda
parents: 8859
diff changeset
    29
                test
8859
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    30
                OUTPUT_VARIABLE RESULT_OUTPUT
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    31
                )
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    32
    set(PASCAL_TEST_WAS_RUN 1)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    33
endif(NOT CMAKE_Pascal_COMPILER_WORKS)
8750
d9e57426e759 barebone cmake config file to support pascal files, based off plplot's ada files
koda
parents:
diff changeset
    34
8859
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    35
if(NOT CMAKE_Pascal_COMPILER_WORKS)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    36
    message(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER} -- broken")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    37
    file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeError.log
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    38
         "Determining if the Pascal compiler works failed with "
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    39
         "the following output:\n${RESULT_OUTPUT}\n\n")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    40
    message(FATAL_ERROR "The Pascal builder \"${CMAKE_Pascal_COMPILER}\" "
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    41
            "is not able to compile and link a simple test program.\nIt fails "
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    42
            "with the following output:\n ${RESULT_OUTPUT}\n\n"
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    43
            "CMake will not be able to correctly generate this project.")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    44
else(NOT CMAKE_Pascal_COMPILER_WORKS)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    45
    if(PASCAL_TEST_WAS_RUN)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    46
        message(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER} -- works")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    47
        file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    48
             "Determining if the Pascal compiler works passed with "
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    49
             "the following output:\n${RESULT_OUTPUT}\n\n")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    50
    endif(PASCAL_TEST_WAS_RUN)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    51
    set(CMAKE_Pascal_COMPILER_WORKS 1 CACHE INTERNAL "")
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    52
endif(NOT CMAKE_Pascal_COMPILER_WORKS)
bead90828a94 cmake netiquette
koda
parents: 8758
diff changeset
    53