mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
Ninja: Add support for ADDITIONAL_CLEAN_FILES directory property
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include "cmCustomCommand.h"
|
#include "cmCustomCommand.h"
|
||||||
#include "cmCustomCommandGenerator.h"
|
#include "cmCustomCommandGenerator.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
#include "cmGeneratorExpression.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmGlobalNinjaGenerator.h"
|
#include "cmGlobalNinjaGenerator.h"
|
||||||
@@ -94,6 +95,7 @@ void cmLocalNinjaGenerator::Generate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->WriteCustomCommandBuildStatements();
|
this->WriteCustomCommandBuildStatements();
|
||||||
|
this->AdditionalCleanFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it.
|
// TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it.
|
||||||
@@ -598,3 +600,26 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
|
|||||||
|
|
||||||
return launcher;
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -105,6 +105,8 @@ private:
|
|||||||
std::string const& customStep,
|
std::string const& customStep,
|
||||||
cmGeneratorTarget const* target) const;
|
cmGeneratorTarget const* target) const;
|
||||||
|
|
||||||
|
void AdditionalCleanFiles();
|
||||||
|
|
||||||
std::string HomeRelativeOutputPath;
|
std::string HomeRelativeOutputPath;
|
||||||
|
|
||||||
typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*>>
|
typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*>>
|
||||||
|
Reference in New Issue
Block a user