summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-08-06 14:27:17 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-18 15:18:48 (GMT)
commit7386d0d6df1b10f14accf843683eaf8692309c1f (patch)
treeaf064bb982f56c488297e0ed11a1fa6a89c16251 /Tests
parentebd8fa2256c9293b3887f6aeecc9aa7ee718137d (diff)
downloadCMake-7386d0d6df1b10f14accf843683eaf8692309c1f.zip
CMake-7386d0d6df1b10f14accf843683eaf8692309c1f.tar.gz
CMake-7386d0d6df1b10f14accf843683eaf8692309c1f.tar.bz2
Add CheckFortranSourceCompiles module (#14656)
Copy the CheckCSourceCompiles module and port it to Fortran. Extend the FortranOnly test to try using the new module. Suggested-by: Nicolas Bock <nicolasbock@gmail.com>
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FortranOnly/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index d57a8b2..a3f83c9 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -43,3 +43,25 @@ add_custom_target(checksayhello ALL
COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake
)
add_dependencies(checksayhello sayhello)
+
+# Exclude this test on IBM XL for now because the check strangely
+# fails with 'ld: 0706-029 Use a number with the -H flag'.
+if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL)
+ set(err_log ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log)
+ file(REMOVE "${err_log}")
+ include(CheckFortranSourceCompiles)
+ unset(HAVE_PRINT CACHE)
+ CHECK_Fortran_SOURCE_COMPILES([[
+ PROGRAM TEST_HAVE_PRINT
+ PRINT *, 'Hello'
+ END
+]] HAVE_PRINT)
+ if(NOT HAVE_PRINT)
+ if(EXISTS "${err_log}")
+ file(READ "${err_log}" err)
+ endif()
+ string(REPLACE "\n" "\n " err " ${err}")
+ message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n"
+ "${err}")
+ endif()
+endif()