summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-05-13 14:42:46 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-05-14 15:50:14 (GMT)
commit890a1b9dc34820b73f77221f68e04cf1ae811234 (patch)
tree28714f0da2667444d3bfe0173d0fd1f70a4a59f8 /Source/cmLocalNinjaGenerator.cxx
parent7b23001f20440d6c631d9fd6df4ec0092efce4f5 (diff)
downloadCMake-890a1b9dc34820b73f77221f68e04cf1ae811234.zip
CMake-890a1b9dc34820b73f77221f68e04cf1ae811234.tar.gz
CMake-890a1b9dc34820b73f77221f68e04cf1ae811234.tar.bz2
Ninja: Add support for ADDITIONAL_CLEAN_FILES directory property
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r--Source/cmLocalNinjaGenerator.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e6d4457..7fc5776 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalNinjaGenerator.h"
@@ -94,6 +95,7 @@ void cmLocalNinjaGenerator::Generate()
}
this->WriteCustomCommandBuildStatements();
+ this->AdditionalCleanFiles();
}
// TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it.
@@ -598,3 +600,26 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
return launcher;
}
+
+void cmLocalNinjaGenerator::AdditionalCleanFiles()
+{
+ if (const char* prop_value =
+ this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
+ std::vector<std::string> cleanFiles;
+ {
+ cmGeneratorExpression ge;
+ auto cge = ge.Parse(prop_value);
+ cmSystemTools::ExpandListArgument(
+ cge->Evaluate(this,
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")),
+ cleanFiles);
+ }
+ std::string const& binaryDir = this->GetCurrentBinaryDirectory();
+ cmGlobalNinjaGenerator* gg = this->GetGlobalNinjaGenerator();
+ for (std::string const& cleanFile : cleanFiles) {
+ // Support relative paths
+ gg->AddAdditionalCleanFile(
+ cmSystemTools::CollapseFullPath(cleanFile, binaryDir));
+ }
+ }
+}