1 # This file is used by EnableLanguage in cmGlobalGenerator to determine that |
1 # This file is used by EnableLanguage in cmGlobalGenerator to determine that |
2 # the FreePascal can actually compile and link the most basic of programs. |
2 # the FreePascal can actually compile and link the most basic of programs. |
3 # If not, a fatal error is set, cmake stops processing commands and will not |
3 # If not, a fatal error is set, cmake stops processing commands and will not |
4 # generate any makefiles or projects. |
4 # generate any makefiles or projects. |
5 |
5 |
6 IF(NOT CMAKE_Pascal_COMPILER_WORKS) |
6 if(NOT CMAKE_Pascal_COMPILER_WORKS) |
7 MESSAGE(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER}") |
7 message(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER}") |
8 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/testpascalcompiler.pas |
8 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/testpascalcompiler.pas |
9 "program testPascalCompiler; |
9 "program testPascalCompiler; |
10 begin |
10 begin |
11 end. |
11 end. |
12 ") |
12 ") |
13 |
13 |
14 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt |
14 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt |
15 "set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) |
15 "set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) |
16 set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL \"\" FORCE) |
16 set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL \"\" FORCE) |
17 project(test Pascal) |
17 project(test Pascal) |
18 add_executable(testpascalcompiler testpascalcompiler.pas) |
18 add_executable(testpascalcompiler testpascalcompiler.pas) |
19 ") |
19 ") |
20 |
20 |
21 # To avoid try_compile recurse error, use any binary directory other |
21 # To avoid try_compile recurse error, use any binary directory other |
22 # than ${CMAKE_BINARY_DIR}. The choice of |
22 # than ${CMAKE_BINARY_DIR}. The choice of |
23 # bindir = ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp is |
23 # bindir = ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp is |
24 # especially advantageous since it makes an in-source build which |
24 # especially advantageous since it makes an in-source build which |
25 # means that no special variables need to be set to find files. |
25 # means that no special variables need to be set to find files. |
26 try_compile(CMAKE_Pascal_COMPILER_WORKS |
26 try_compile(CMAKE_Pascal_COMPILER_WORKS |
27 ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp |
27 ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp |
28 ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp |
28 ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp |
29 projectName |
29 projectName |
30 OUTPUT_VARIABLE RESULT_OUTPUT |
30 OUTPUT_VARIABLE RESULT_OUTPUT |
31 ) |
31 ) |
32 SET(PASCAL_TEST_WAS_RUN 1) |
32 set(PASCAL_TEST_WAS_RUN 1) |
33 ENDIF(NOT CMAKE_Pascal_COMPILER_WORKS) |
33 endif(NOT CMAKE_Pascal_COMPILER_WORKS) |
34 |
34 |
35 IF(NOT CMAKE_Pascal_COMPILER_WORKS) |
35 if(NOT CMAKE_Pascal_COMPILER_WORKS) |
36 MESSAGE(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER} -- broken") |
36 message(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER} -- broken") |
37 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeError.log |
37 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeError.log |
38 "Determining if the Pascal compiler works failed with " |
38 "Determining if the Pascal compiler works failed with " |
39 "the following output:\n${RESULT_OUTPUT}\n\n") |
39 "the following output:\n${RESULT_OUTPUT}\n\n") |
40 MESSAGE(FATAL_ERROR "The Pascal builder \"${CMAKE_Pascal_COMPILER}\" " |
40 message(FATAL_ERROR "The Pascal builder \"${CMAKE_Pascal_COMPILER}\" " |
41 "is not able to compile and link a simple test program.\nIt fails " |
41 "is not able to compile and link a simple test program.\nIt fails " |
42 "with the following output:\n ${RESULT_OUTPUT}\n\n" |
42 "with the following output:\n ${RESULT_OUTPUT}\n\n" |
43 "CMake will not be able to correctly generate this project.") |
43 "CMake will not be able to correctly generate this project.") |
44 ELSE(NOT CMAKE_Pascal_COMPILER_WORKS) |
44 else(NOT CMAKE_Pascal_COMPILER_WORKS) |
45 IF(PASCAL_TEST_WAS_RUN) |
45 if(PASCAL_TEST_WAS_RUN) |
46 MESSAGE(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER} -- works") |
46 message(STATUS "Check for working Pascal compiler: ${CMAKE_Pascal_COMPILER} -- works") |
47 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeOutput.log |
47 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeOutput.log |
48 "Determining if the Pascal compiler works passed with " |
48 "Determining if the Pascal compiler works passed with " |
49 "the following output:\n${RESULT_OUTPUT}\n\n") |
49 "the following output:\n${RESULT_OUTPUT}\n\n") |
50 ENDIF(PASCAL_TEST_WAS_RUN) |
50 endif(PASCAL_TEST_WAS_RUN) |
51 SET(CMAKE_Pascal_COMPILER_WORKS 1 CACHE INTERNAL "") |
51 set(CMAKE_Pascal_COMPILER_WORKS 1 CACHE INTERNAL "") |
52 ENDIF(NOT CMAKE_Pascal_COMPILER_WORKS) |
52 endif(NOT CMAKE_Pascal_COMPILER_WORKS) |
|
53 |