summaryrefslogtreecommitdiff
path: root/Tests/FortranOnly
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2018-12-06 15:09:54 -0500
committerBrad King <brad.king@kitware.com>2019-01-10 14:09:12 -0500
commit10a1477b631d9173a32827a315aebf1941c87564 (patch)
tree07e582628ada224c880dd8101d567a159cc4c8f0 /Tests/FortranOnly
parent6092a770f66bff959749170141d44188f4b6f3f1 (diff)
downloadcmake-10a1477b631d9173a32827a315aebf1941c87564.tar.gz
CheckFortranSourceRuns: Add module to check if Fortran code runs
Add a Fortran equivalent to the existing `Check{C,CXX}SourceRuns` modules.
Diffstat (limited to 'Tests/FortranOnly')
-rw-r--r--Tests/FortranOnly/CMakeLists.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index 59e6d592e8..77f6041878 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -70,8 +70,15 @@ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL)
include(CheckFortranCompilerFlag)
CHECK_Fortran_COMPILER_FLAG(-_this_is_not_a_flag_ Fortran_BOGUS_FLAG)
if (Fortran_BOGUS_FLAG)
- message (SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed")
- endif ()
+ message(SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed")
+ endif()
+
+ unset(Fortran_RUN_FLAG CACHE)
+ include(CheckFortranSourceRuns)
+ check_fortran_source_runs("program a; end program" Fortran_RUN_FLAG SRC_EXT F90)
+ if(NOT Fortran_RUN_FLAG)
+ message(SEND_ERROR "CHECK_Fortran_SOURCE_RUNS() failed")
+ endif()
endif()
# Test generation of preprocessed sources.