summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-02-20 13:13:01 (GMT)
committerBrad King <brad.king@kitware.com>2019-02-20 13:13:57 (GMT)
commit3dc81a48ffbf22e044678736996272ef1b8395ff (patch)
tree1f90f055806a996156196557274cde73d1e37938 /Source/cmLocalGenerator.cxx
parent890bae524c6b97d29ffcc3fe5a6a30235d800348 (diff)
downloadCMake-3dc81a48ffbf22e044678736996272ef1b8395ff.zip
CMake-3dc81a48ffbf22e044678736996272ef1b8395ff.tar.gz
CMake-3dc81a48ffbf22e044678736996272ef1b8395ff.tar.bz2
Fortran: Do not suppress explicit use of implicit include directories
Since commit 2e91627dea (ParseImplicitIncludeInfo: add Fortran implicit include handling, 2019-01-25, v3.14.0-rc1~73^2) we actually populate `CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES` for the first time. This value may be useful to project code to pass to other tooling that wants to preprocess the way Fortran does, so we should compute the value. However, compilers like `gfortran` do not actually search their own implicit include directories for `.mod` files. The directories must be passed via `-I` in order for `.mod` files in them to be found. Since Fortran has no standard library header files that we need to avoid overriding, it is safe to *not* filter out implicit include directories from those passed explicitly via `-I` options. Skip this filtering so that include directories specified by project code to find `.mod` files will be searched by the compiler even if they happen to be implicitly searched by the preprocessor. Fixes: #18914
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8b01af1..7e56818 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -947,15 +947,21 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
std::vector<std::string> impDirVec = userStandardDirs;
// Load implicit include directories for this language.
- std::string key = "CMAKE_";
- key += lang;
- key += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if (const char* value = this->Makefile->GetDefinition(key)) {
- size_t const impDirVecOldSize = impDirVec.size();
- cmSystemTools::ExpandListArgument(value, impDirVec);
- // FIXME: Use cmRange with 'advance()' when it supports non-const.
- for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
- cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
+ // We ignore this for Fortran because:
+ // * There are no standard library headers to avoid overriding.
+ // * Compilers like gfortran do not search their own implicit include
+ // directories for modules ('.mod' files).
+ if (lang != "Fortran") {
+ std::string key = "CMAKE_";
+ key += lang;
+ key += "_IMPLICIT_INCLUDE_DIRECTORIES";
+ if (const char* value = this->Makefile->GetDefinition(key)) {
+ size_t const impDirVecOldSize = impDirVec.size();
+ cmSystemTools::ExpandListArgument(value, impDirVec);
+ // FIXME: Use cmRange with 'advance()' when it supports non-const.
+ for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
+ cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
+ }
}
}