Merge topic 'ninja-gfortran-fpreprocessed'

90a34ff7 Ninja: Fix references to source files in gfortran diagnostics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1146
This commit is contained in:
Brad King
2017-08-24 13:33:18 +00:00
committed by Kitware Robot
2 changed files with 9 additions and 1 deletions
+2
View File
@@ -7,6 +7,8 @@ set(CMAKE_Fortran_PREPROCESS_SOURCE
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed")
# No -DNDEBUG for Fortran.
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+7 -1
View File
@@ -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"]);