diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-08-26 19:50:39 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-08-26 19:50:39 (GMT) |
commit | e803b32b89761c8fa5c0f944e651b456aad9a77f (patch) | |
tree | 5d112b95cf5a0ff5401164d0a7891838b1250486 | |
parent | 66a08c10e5bd4b8eff58837cd58372a4dfdd19df (diff) | |
download | CMake-e803b32b89761c8fa5c0f944e651b456aad9a77f.zip CMake-e803b32b89761c8fa5c0f944e651b456aad9a77f.tar.gz CMake-e803b32b89761c8fa5c0f944e651b456aad9a77f.tar.bz2 |
Add a fortran test if there is a fortran compiler
-rw-r--r-- | Modules/CMakeDetermineFortranCompiler.cmake | 47 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 17 |
2 files changed, 38 insertions, 26 deletions
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index de75627..9098e00 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -4,7 +4,6 @@ # use environment variable CCC first if defined by user, next use # the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator # as a default compiler - IF(NOT CMAKE_Fortran_COMPILER) # prefer the environment variable CC IF($ENV{FC} MATCHES ".+") @@ -14,39 +13,39 @@ IF(NOT CMAKE_Fortran_COMPILER) MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") ENDIF(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) ENDIF($ENV{FC} MATCHES ".+") - + # next try prefer the compiler specified by the generator IF(CMAKE_GENERATOR_FC) IF(NOT CMAKE_Fortran_COMPILER_INIT) SET(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) ENDIF(NOT CMAKE_Fortran_COMPILER_INIT) ENDIF(CMAKE_GENERATOR_FC) - - + + # if no compiler has been specified yet, then look for one IF(NOT CMAKE_Fortran_COMPILER_INIT) - # if not in the envionment then search for the compiler in the path# Known compilers: - # f77/f90/f95: generic compiler names - # g77: GNU Fortran 77 compiler - # gfortran: putative GNU Fortran 95+ compiler (in progress) - # fort77: native F77 compiler under HP-UX (and some older Crays) - # frt: Fujitsu F77 compiler - # pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers - # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers - # lf95: Lahey-Fujitsu F95 compiler - # fl32: Microsoft Fortran 77 "PowerStation" compiler - # af77: Apogee F77 compiler for Intergraph hardware running CLIX - # epcf90: "Edinburgh Portable Compiler" F90 - # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha - # ifc: Intel Fortran 95 compiler for Linux/x86 - # efc: Intel Fortran 95 compiler for IA64 - # the order is 95 or newer compilers first, then 90, then 77 or older compilers, gnu is always last in the group, - # so if you paid for a compiler it is picked by default - SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran f90 pgf90 xlf90 epcf90 - f77 fort77 frt pgf77 xlf fl32 af77 g77 ) + # if not in the envionment then search for the compiler in the path# Known compilers: + # f77/f90/f95: generic compiler names + # g77: GNU Fortran 77 compiler + # gfortran: putative GNU Fortran 95+ compiler (in progress) + # fort77: native F77 compiler under HP-UX (and some older Crays) + # frt: Fujitsu F77 compiler + # pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers + # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers + # lf95: Lahey-Fujitsu F95 compiler + # fl32: Microsoft Fortran 77 "PowerStation" compiler + # af77: Apogee F77 compiler for Intergraph hardware running CLIX + # epcf90: "Edinburgh Portable Compiler" F90 + # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha + # ifc: Intel Fortran 95 compiler for Linux/x86 + # efc: Intel Fortran 95 compiler for IA64 + # the order is 95 or newer compilers first, then 90, then 77 or older compilers, gnu is always last in the group, + # so if you paid for a compiler it is picked by default + SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 + lf95 xlf95 fort gfortran f90 pgf90 xlf90 epcf90 f77 fort77 frt pgf77 xlf fl32 af77 g77 ) FIND_PROGRAM(CMAKE_Fortran_COMPILER_FULLPATH NAMES ${CMAKE_Fortran_COMPILER_LIST} ) GET_FILENAME_COMPONENT(CMAKE_Fortran_COMPILER_INIT - ${CMAKE_Fortran_COMPILER_FULLPATH} NAME) + ${CMAKE_Fortran_COMPILER_FULLPATH} NAME) SET(CMAKE_Fortran_COMPILER_FULLPATH "${CMAKE_Fortran_COMPILER_FULLPATH}" CACHE INTERNAL "full path to the compiler cmake found") ENDIF(NOT CMAKE_Fortran_COMPILER_INIT) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 1a1fea0..8dd53e1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -616,8 +616,21 @@ IF(BUILD_TESTING) ) ENDIF (CTEST_TEST_CTEST) - - + # see if we can find a fortran compiler on the machine + # if so, add the fortran test and see if it works. + INCLUDE(CMakeDetermineFortranCompiler) + IF(CMAKE_Fortran_COMPILER_FULLPATH) + ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Fortran" + "${CMake_BINARY_DIR}/Tests/Fortran" + --build-generator ${CMAKE_GENERATOR} + --build-project Simple + --build-makeprogram ${MAKEPROGRAM} + --build-two-config + --test-command testf) + ENDIF(CMAKE_Fortran_COMPILER_FULLPATH) + IF (CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE OR WXWINDOWS_INCLUDE_DIR) # Will be set if the wxwindows gui is on ADD_TEST(UseWX ${CMAKE_CTEST_COMMAND} |