summaryrefslogtreecommitdiff
path: root/Tests/Fortran
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-09 10:30:11 -0500
committerBrad King <brad.king@kitware.com>2008-01-09 10:30:11 -0500
commitb761da39c14c9f003d9113418aca9370f30a5e6e (patch)
tree3307dab56eb95df89992cb8c407dbe6d9d625fe4 /Tests/Fortran
parent09e309c3d097f8cc58fc16c4194d0f51dec9f02d (diff)
downloadcmake-b761da39c14c9f003d9113418aca9370f30a5e6e.tar.gz
ENH: Patch from Maik to add preprocessor directive handling to Fortran dependency scanning. Also added -fpp flag to Intel Fortran compiler on Windows by default.
Diffstat (limited to 'Tests/Fortran')
-rw-r--r--Tests/Fortran/CMakeLists.txt3
-rw-r--r--Tests/Fortran/test_preprocess.F9055
2 files changed, 58 insertions, 0 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 3a299b2a97..54f18d06d1 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -23,6 +23,9 @@ IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
in_interface/main.f90
in_interface/module.f90)
+ ADD_DEFINITIONS(-DFOO -DBAR=1)
+ ADD_EXECUTABLE(test_preprocess test_preprocess.F90)
+
SET(TEST_MODULE_DEPENDS 1)
ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/Fortran/test_preprocess.F90
new file mode 100644
index 0000000000..374a6ff774
--- /dev/null
+++ b/Tests/Fortran/test_preprocess.F90
@@ -0,0 +1,55 @@
+MODULE Available
+! no conent
+END MODULE
+
+PROGRAM PPTEST
+! value of InPPFalseBranch ; values of SkipToEnd
+! 0 <empty>
+#ifndef FOO
+ ! 1 ; <0>
+ USE NotAvailable
+# ifndef FOO
+ ! 2 ; <0,0>
+ USE NotAvailable
+# else
+ ! 2 ; <0,0>
+ USE NotAvailable
+# endif
+ ! 1 ; <0>
+# ifdef FOO
+ ! 2 ; <0,1>
+ USE NotAvailable
+# else
+ ! 2 ; <0,1>
+ USE NotAvailable
+# endif
+ ! 1 ; <0>
+#else
+ ! 0 ; <0>
+ USE Available
+# ifndef FOO
+ ! 1 ; <0,0>
+ USE NotAvailable
+# else
+ ! 0 ; <0,0>
+ USE Available
+# endif
+ ! 0 ; <0>
+# ifdef FOO
+ ! 0 ; <0,1>
+ USE Available
+# else
+ ! 1 ; <0,1>
+ USE NotAvailable
+# endif
+ ! 0 ; <0>
+#endif
+! 0 ; <empty>
+
+#ifdef BAR
+ PRINT * , 'BAR was defined via ADD_DEFINITIONS'
+#else
+ PRINT *, 'If you can read this something went wrong'
+#endif
+
+END PROGRAM