summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-27 12:22:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-09-27 12:22:35 (GMT)
commit4207aa47243eb268efcd77f3428a818d0f303829 (patch)
tree9f34a7106e57a4d9fca9d05e343cd3ac600b8eb8 /Source
parent20786869e8b60b1917aa2f7681971e6ecd1f6393 (diff)
parent144cc6f1f9020433cb4a94f072fc74f1202ce1f3 (diff)
downloadCMake-4207aa47243eb268efcd77f3428a818d0f303829.zip
CMake-4207aa47243eb268efcd77f3428a818d0f303829.tar.gz
CMake-4207aa47243eb268efcd77f3428a818d0f303829.tar.bz2
Merge topic 'ninja-include-dir'
144cc6f1 Ninja: Add source location as include directory for preprocessed files
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b418ce3..f88eb7b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -841,6 +841,18 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// directive.
ppVars["INCLUDES"] = vars["INCLUDES"];
+ // Prepend source file's original directory as an include directory
+ // so e.g. Fortran INCLUDE statements can look for files in it.
+ std::vector<std::string> sourceDirectory;
+ sourceDirectory.push_back(
+ cmSystemTools::GetParentDirectory(source->GetFullPath()));
+
+ std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags(
+ sourceDirectory, this->GeneratorTarget, language, false, false,
+ this->GetConfigName());
+
+ vars["INCLUDES"] = sourceDirectoryFlag + " " + vars["INCLUDES"];
+
// Explicit preprocessing always uses a depfile.
ppVars["DEP_FILE"] =
cmGlobalNinjaGenerator::EncodeDepfileSpace(ppFileName + ".d");