summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx49
1 files changed, 36 insertions, 13 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 1bdef53..587e18a 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -2,11 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalNinjaGenerator.h"
+#include "cm_jsoncpp_reader.h"
+#include "cm_jsoncpp_value.h"
+#include "cm_jsoncpp_writer.h"
+#include "cmsys/FStream.hxx"
#include <algorithm>
-#include <cm_jsoncpp_reader.h>
-#include <cm_jsoncpp_value.h>
-#include <cm_jsoncpp_writer.h>
-#include <cmsys/FStream.hxx>
#include <ctype.h>
#include <functional>
#include <iterator>
@@ -246,7 +246,7 @@ void cmGlobalNinjaGenerator::WriteBuild(
bool useResponseFile = false;
if (cmdLineLimit < 0 ||
(cmdLineLimit > 0 &&
- (args.size() + buildstr.size() + assignments.size()) >
+ (args.size() + buildstr.size() + assignments.size() + 1000) >
static_cast<size_t>(cmdLineLimit))) {
variable_assignments.str(std::string());
cmGlobalNinjaGenerator::WriteVariable(variable_assignments, "RSP_FILE",
@@ -966,8 +966,14 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
}
}
+std::string OrderDependsTargetForTarget(cmGeneratorTarget const* target)
+{
+ return "cmake_object_order_depends_target_" + target->GetName();
+}
+
void cmGlobalNinjaGenerator::AppendTargetOutputs(
- cmGeneratorTarget const* target, cmNinjaDeps& outputs)
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends)
{
std::string configName =
target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
@@ -979,15 +985,27 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
bool realname = target->IsFrameworkOnApple();
switch (target->GetType()) {
- case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
- outputs.push_back(this->ConvertToNinjaPath(
- target->GetFullPath(configName, false, realname)));
+ if (depends == DependOnTargetOrdering) {
+ outputs.push_back(OrderDependsTargetForTarget(target));
+ break;
+ }
+ }
+ // FALLTHROUGH
+ case cmStateEnums::EXECUTABLE: {
+ outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath(
+ configName, cmStateEnums::RuntimeBinaryArtifact, realname)));
break;
}
- case cmStateEnums::OBJECT_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY: {
+ if (depends == DependOnTargetOrdering) {
+ outputs.push_back(OrderDependsTargetForTarget(target));
+ break;
+ }
+ }
+ // FALLTHROUGH
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::UTILITY: {
std::string path =
@@ -1003,7 +1021,8 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
}
void cmGlobalNinjaGenerator::AppendTargetDepends(
- cmGeneratorTarget const* target, cmNinjaDeps& outputs)
+ cmGeneratorTarget const* target, cmNinjaDeps& outputs,
+ cmNinjaTargetDepends depends)
{
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
// These depend only on other CMake-provided targets, e.g. "all".
@@ -1023,7 +1042,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
- this->AppendTargetOutputs(*i, outs);
+ this->AppendTargetOutputs(*i, outs, depends);
}
std::sort(outs.begin(), outs.end());
outputs.insert(outputs.end(), outs.begin(), outs.end());
@@ -1823,10 +1842,14 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
std::vector<std::string>::const_iterator argEnd)
{
+ std::vector<std::string> arg_full =
+ cmSystemTools::HandleResponseFile(argBeg, argEnd);
+
std::string arg_dd;
std::string arg_tdi;
std::vector<std::string> arg_ddis;
- for (std::vector<std::string>::const_iterator a = argBeg; a != argEnd; ++a) {
+ for (std::vector<std::string>::const_iterator a = arg_full.begin();
+ a != arg_full.end(); ++a) {
std::string const& arg = *a;
if (cmHasLiteralPrefix(arg, "--tdi=")) {
arg_tdi = arg.substr(6);