summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index d38dbcb..4a4e5b2 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -47,14 +47,14 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
return new cmNinjaUtilityTargetGenerator(target);
default:
- return CM_NULLPTR;
+ return nullptr;
}
}
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
: cmCommonTargetGenerator(target)
- , MacOSXContentGenerator(CM_NULLPTR)
- , OSXBundleGenerator(CM_NULLPTR)
+ , MacOSXContentGenerator(nullptr)
+ , OSXBundleGenerator(nullptr)
, MacContentFolders()
, LocalGenerator(
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator()))
@@ -557,17 +557,11 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
// Write the rule for ninja dyndep file generation.
std::vector<std::string> ddCmds;
-#ifdef _WIN32
- // Windows command line length is limited -> use response file for dyndep
- // rules
+ // Command line length is almost always limited -> use response file for
+ // dyndep rules
std::string ddRspFile = "$out.rsp";
std::string ddRspContent = "$in";
std::string ddInput = "@" + ddRspFile;
-#else
- std::string ddRspFile;
- std::string ddRspContent;
- std::string ddInput = "$in";
-#endif
// Run CMake dependency scanner on preprocessed output.
std::string const cmake = this->GetLocalGenerator()->ConvertToOutputFormat(
@@ -648,7 +642,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
}
// Maybe insert a compiler launcher like ccache or distcc
- if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) {
+ if (!compileCmds.empty() &&
+ (lang == "C" || lang == "CXX" || lang == "CUDA")) {
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
const char* clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
if (clauncher && *clauncher) {
@@ -896,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"]);