summaryrefslogtreecommitdiffstats
path: root/Tests/FortranOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-04 12:49:44 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-04 12:50:19 (GMT)
commitefbd50383386c00cde63a7b67672b8487b00980f (patch)
treeba01d67c8aa215f338138a7cbc919d5e40b617df /Tests/FortranOnly
parent2b478a921aedd55c2596bc0cb083ffea7244bb0e (diff)
parentfb9da8e6f421263e8904e8d12586bf7b068ed3b4 (diff)
downloadCMake-efbd50383386c00cde63a7b67672b8487b00980f.zip
CMake-efbd50383386c00cde63a7b67672b8487b00980f.tar.gz
CMake-efbd50383386c00cde63a7b67672b8487b00980f.tar.bz2
Merge topic 'fortran-INCLUDE-defines'
fb9da8e6f4 Ninja: Pass preprocessor definitions when compiling with Intel Fortran Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3764
Diffstat (limited to 'Tests/FortranOnly')
-rw-r--r--Tests/FortranOnly/CMakeLists.txt8
-rw-r--r--Tests/FortranOnly/IntelIfDef.f3
-rw-r--r--Tests/FortranOnly/IntelIfDef.inc3
3 files changed, 14 insertions, 0 deletions
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index 45372dd..de887fa 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -112,3 +112,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
)
endif()
endif()
+
+# Test that with Intel Fortran we always compile with preprocessor
+# defines even if splitting the preprocessing and compilation steps.
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
+ add_executable(IntelIfDef IntelIfDef.f)
+ set_property(TARGET IntelIfDef PROPERTY Fortran_FORMAT FIXED)
+ target_compile_definitions(IntelIfDef PRIVATE SOME_DEF)
+endif()
diff --git a/Tests/FortranOnly/IntelIfDef.f b/Tests/FortranOnly/IntelIfDef.f
new file mode 100644
index 0000000..d7a73d1
--- /dev/null
+++ b/Tests/FortranOnly/IntelIfDef.f
@@ -0,0 +1,3 @@
+ INCLUDE 'IntelIfDef.inc'
+ PROGRAM IntelIfDef
+ END
diff --git a/Tests/FortranOnly/IntelIfDef.inc b/Tests/FortranOnly/IntelIfDef.inc
new file mode 100644
index 0000000..52edafa
--- /dev/null
+++ b/Tests/FortranOnly/IntelIfDef.inc
@@ -0,0 +1,3 @@
+CDEC$ IF .NOT. DEFINED(SOME_DEF)
+CDEC$ INCLUDE 'SOME_DEF not defined'
+CDEC$ END IF