From: Alan W. I. <ai...@us...> - 2007-03-15 00:29:27
|
Update of /cvsroot/plplot/plplot/cmake/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3947 Modified Files: CMakeTestAdaCompiler.cmake Log Message: Finally, found a way to use the first form of TRY_COMPILE to test Ada compilation. Index: CMakeTestAdaCompiler.cmake =================================================================== RCS file: /cvsroot/plplot/plplot/cmake/modules/CMakeTestAdaCompiler.cmake,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CMakeTestAdaCompiler.cmake 6 Mar 2007 18:46:53 -0000 1.3 +++ CMakeTestAdaCompiler.cmake 15 Mar 2007 00:29:25 -0000 1.4 @@ -15,36 +15,25 @@ " ) -# FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt -# " -#set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) -#project(test Ada) -#add_executable(testadacompiler testadacompiler.adb) -# " -# ) + FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt + " +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) +project(test Ada) +add_executable(testadacompiler testadacompiler.adb) + " + ) - execute_process( - COMMAND ${GNAT_EXECUTABLE_BUILDER} testadacompiler.adb - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp - RESULT_VARIABLE CMAKE_Ada_COMPILER_WORKS +# To avoid try_compile recurse error, use any binary directory other than +# ${CMAKE_BINARY_DIR}. The choice of +# bindir = ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp is +# especially advantageous since it makes an in-source build which +# means that no special variables need to be set to find files. + try_compile(CMAKE_Ada_COMPILER_WORKS + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + projectName OUTPUT_VARIABLE OUTPUT - ERROR_VARIABLE OUTPUT ) - if(NOT CMAKE_Ada_COMPILER_WORKS) - set(CMAKE_Ada_COMPILER_WORKS ON) - else(NOT CMAKE_Ada_COMPILER_WORKS) - set(CMAKE_Ada_COMPILER_WORKS OFF) - endif(NOT CMAKE_Ada_COMPILER_WORKS) - -# Other languages avoid infinite try_compile recursion, but I don't know -# how to do that for Ada. Anyhow, use the above execute_process alternative -# instead for now. -# try_compile(CMAKE_Ada_COMPILER_WORKS -# ${CMAKE_BINARY_DIR} -# ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp -# projectName -# OUTPUT_VARIABLE OUTPUT -# ) SET(ADA_TEST_WAS_RUN 1) ENDIF(NOT CMAKE_Ada_COMPILER_WORKS) |