summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorRaul Laasner <raullaasner@gmail.com>2017-08-16 18:12:35 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-23 19:32:44 (GMT)
commit90a34ff79196c90b64ab16066f957e51a78a7375 (patch)
tree2ba98401066f29831a7e90e2806f63e4f3a7653f /Source/cmNinjaTargetGenerator.cxx
parentf59d8e5982f5716fb912a795ed93f808e4791532 (diff)
downloadCMake-90a34ff79196c90b64ab16066f957e51a78a7375.zip
CMake-90a34ff79196c90b64ab16066f957e51a78a7375.tar.gz
CMake-90a34ff79196c90b64ab16066f957e51a78a7375.tar.bz2
Ninja: Fix references to source files in gfortran diagnostics
The Ninja generator preprocesses and compiles separately for Fortran. When compiling, tell gfortran that the source is already preprocessed so that it will honor the `# <line>` directives when producing diagnostics messages. Fixes: #17160
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 7cc6ede..4b16dc7 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -891,9 +891,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// The actual compilation will now use the preprocessed source.
explicitDeps.push_back(ppFileName);
- // Preprocessing and compilation use the same flags.
+ // Preprocessing and compilation generally use the same flags.
ppVars["FLAGS"] = vars["FLAGS"];
+ // In case compilation requires flags that are incompatible with
+ // preprocessing, include them here.
+ std::string const postFlag =
+ this->Makefile->GetSafeDefinition("CMAKE_Fortran_POSTPROCESS_FLAG");
+ this->LocalGenerator->AppendFlags(vars["FLAGS"], postFlag);
+
// Move preprocessor definitions to the preprocessor build statement.
std::swap(ppVars["DEFINES"], vars["DEFINES"]);