summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-09 14:13:53 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-12-09 14:14:00 (GMT)
commitacc9c89914ca184d107efd8a84282553c271de60 (patch)
tree3f82138ae828c232140d3e4004ade81b66b0d643 /Source
parentd5b12ddcbca4d0919056c7815a9335087e9f2638 (diff)
parent10809357322789889670d5829bb96fcc545870af (diff)
downloadCMake-acc9c89914ca184d107efd8a84282553c271de60.zip
CMake-acc9c89914ca184d107efd8a84282553c271de60.tar.gz
CMake-acc9c89914ca184d107efd8a84282553c271de60.tar.bz2
Merge topic 'cmp0116-automoc'
1080935732 AutoGen: Account for CMP0116 in the depfile 287c591079 cmake -E: Fix cmake_transform_depfile escaping of transformed paths Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kyle Edwards <kyle.edwards@kitware.com> Merge-request: !5584
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenInitializer.cxx23
-rw-r--r--Source/cmTransformDepfile.cxx3
2 files changed, 20 insertions, 6 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index f27b788..67834f1 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -29,6 +29,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmGlobalNinjaGenerator.h"
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -1237,11 +1238,23 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
const std::string outputFile =
cmStrCat(this->Dir.Build, "/", timestampFileName);
this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps");
- auto relativeBinaryDir = cmSystemTools::RelativePath(
- this->LocalGen->GetBinaryDirectory(),
- this->LocalGen->GetCurrentBinaryDirectory());
- if (!relativeBinaryDir.empty()) {
- relativeBinaryDir = cmStrCat(relativeBinaryDir, "/");
+ std::string relativeBinaryDir;
+ if (dynamic_cast<cmGlobalNinjaGenerator*>(this->GlobalGen)) {
+ switch (this->LocalGen->GetPolicyStatus(cmPolicies::CMP0116)) {
+ case cmPolicies::OLD:
+ case cmPolicies::WARN:
+ relativeBinaryDir = cmSystemTools::RelativePath(
+ this->LocalGen->GetBinaryDirectory(),
+ this->LocalGen->GetCurrentBinaryDirectory());
+ if (!relativeBinaryDir.empty()) {
+ relativeBinaryDir = cmStrCat(relativeBinaryDir, "/");
+ }
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ break;
+ }
}
this->AutogenTarget.DepFileRuleName =
cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/",
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index e1f8753..163d7e0 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -47,7 +47,8 @@ void WriteGccDepfile(cmsys::ofstream& fout, const cmGccDepfileContent& content)
}
fout << ':';
for (auto const& path : dep.paths) {
- fout << " \\\n " << path;
+ fout << " \\\n ";
+ WriteFilenameGcc(fout, path);
}
fout << '\n';
}