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