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