浏览代码

Fortran: Fix passing of preprocessor definitions to dependency scanner

In commit v3.3.0-rc1~352^2~3 (Genex: Allow COMPILE_LANGUAGE when
processing compile definitions, 2015-03-04) the name of the variable
used to pass preprocessor definitions to the Fortran dependency scanner
was changed to be per-language, but the actual dependency scanning code
was not updated accordingly.  Update the code and add a test case.

Reported-by: Radovan Bast <[email protected]>
Brad King 10 年之前
父节点
当前提交
0a203db5dc

+ 1 - 1
Source/cmDependsFortran.cxx

@@ -143,7 +143,7 @@ cmDependsFortran
   std::vector<std::string> definitions;
   std::vector<std::string> definitions;
   cmMakefile* mf = this->LocalGenerator->GetMakefile();
   cmMakefile* mf = this->LocalGenerator->GetMakefile();
   if(const char* c_defines =
   if(const char* c_defines =
-     mf->GetDefinition("CMAKE_TARGET_DEFINITIONS"))
+     mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran"))
     {
     {
     cmSystemTools::ExpandListArgument(c_defines, definitions);
     cmSystemTools::ExpandListArgument(c_defines, definitions);
     }
     }

+ 1 - 1
Tests/Fortran/CMakeLists.txt

@@ -168,7 +168,7 @@ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
 
 
   add_definitions(-DFOO -DBAR=1)
   add_definitions(-DFOO -DBAR=1)
   include_directories(${testf_SOURCE_DIR}/include)
   include_directories(${testf_SOURCE_DIR}/include)
-  add_executable(test_preprocess test_preprocess.F90)
+  add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90)
 
 
   set(TEST_MODULE_DEPENDS 1)
   set(TEST_MODULE_DEPENDS 1)
 endif()
 endif()

+ 2 - 0
Tests/Fortran/test_preprocess.F90

@@ -46,6 +46,8 @@ PROGRAM PPTEST
 #endif
 #endif
 ! 0 ; <empty>
 ! 0 ; <empty>
 
 
+USE PPAvailable
+
 #include "test_preprocess.h"
 #include "test_preprocess.h"
 
 
 END PROGRAM
 END PROGRAM

+ 5 - 0
Tests/Fortran/test_preprocess_module.F90

@@ -0,0 +1,5 @@
+#ifdef FOO
+MODULE PPAvailable
+! no conent
+END MODULE
+#endif