| 1 |
include(CMakeTestCompilerCommon) |
| 2 |
unset(CMAKE_ADA_COMPILER_WORKS CACHE) |
| 3 |
|
| 4 |
if(NOT CMAKE_ADA_COMPILER_WORKS) |
| 5 |
PrintTestCompilerStatus("ADA" "") |
| 6 |
set(_ADA_TEST_FILE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.adb") |
| 7 |
|
| 8 |
file(WRITE ${_ADA_TEST_FILE} |
| 9 |
"with Ada.Text_IO; use Ada.Text_IO;\n" |
| 10 |
"\n" |
| 11 |
"procedure main is\n" |
| 12 |
"begin\n" |
| 13 |
"Put_Line(\"Hello, World!\");\n" |
| 14 |
"end Main;\n") |
| 15 |
|
| 16 |
try_compile(CMAKE_ADA_COMPILER_WORKS ${CMAKE_BINARY_DIR} |
| 17 |
${_ADA_TEST_FILE} |
| 18 |
OUTPUT_VARIABLE __CMAKE_ADA_COMPILER_OUTPUT) |
| 19 |
|
| 20 |
set(CMAKE_ADA_COMPILER_WORKS ${CMAKE_ADA_COMPILER_WORKS}) |
| 21 |
unset(CMAKE_ADA_COMPILER_WORKS CACHE) |
| 22 |
set(ADA_TEST_WAS_RUN TRUE) |
| 23 |
endif(NOT CMAKE_ADA_COMPILER_WORKS) |
| 24 |
|
| 25 |
if(NOT CMAKE_ADA_COMPILER_WORKS) |
| 26 |
PrintTestCompilerStatus("ADA" " -- broken") |
| 27 |
|
| 28 |
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log |
| 29 |
"Determining if the Ada compiler works failed with " |
| 30 |
"the following output:\n${__CMAKE_ADA_COMPILER_OUTPUT}\n\n") |
| 31 |
|
| 32 |
message(FATAL_ERROR "The Ada compiler \"${CMAKE_ADA_COMPILER}\" " |
| 33 |
"is not able to compile a simple test program.\nIt fails " |
| 34 |
"with the following output:\n ${__CMAKE_ADA_COMPILER_OUTPUT}\n\n" |
| 35 |
"CMake will not be able to correctly generate this project.") |
| 36 |
else(NOT CMAKE_ADA_COMPILER_WORKS) |
| 37 |
if(ADA_TEST_WAS_RUN) |
| 38 |
PrintTestCompilerStatus("ADA" " -- works") |
| 39 |
|
| 40 |
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log |
| 41 |
"Determining if the Ada compiler works passed with " |
| 42 |
"the following output:\n${__CMAKE_ADA_COMPILER_OUTPUT}\n\n") |
| 43 |
endif(ADA_TEST_WAS_RUN) |
| 44 |
endif(NOT CMAKE_ADA_COMPILER_WORKS) |
| 45 |
|
| 46 |
unset(__CMAKE_ADA_COMPILER_OUTPUT) |