mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
Ninja: Add support for ADDITIONAL_CLEAN_FILES target property
This commit is contained in:
@@ -83,6 +83,8 @@ void cmNinjaNormalTargetGenerator::Generate()
|
|||||||
this->WriteDeviceLinkStatement();
|
this->WriteDeviceLinkStatement();
|
||||||
this->WriteLinkStatement();
|
this->WriteLinkStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->AdditionalCleanFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
|
void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
|
||||||
|
@@ -1310,6 +1310,31 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
|
|||||||
this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, sourceFileName);
|
this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, sourceFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmNinjaTargetGenerator::AdditionalCleanFiles()
|
||||||
|
{
|
||||||
|
if (const char* prop_value =
|
||||||
|
this->GeneratorTarget->GetProperty("ADDITIONAL_CLEAN_FILES")) {
|
||||||
|
cmLocalNinjaGenerator* lg = this->LocalGenerator;
|
||||||
|
std::vector<std::string> cleanFiles;
|
||||||
|
{
|
||||||
|
cmGeneratorExpression ge;
|
||||||
|
auto cge = ge.Parse(prop_value);
|
||||||
|
cmSystemTools::ExpandListArgument(
|
||||||
|
cge->Evaluate(lg,
|
||||||
|
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"),
|
||||||
|
false, this->GeneratorTarget, nullptr, nullptr),
|
||||||
|
cleanFiles);
|
||||||
|
}
|
||||||
|
std::string const& binaryDir = lg->GetCurrentBinaryDirectory();
|
||||||
|
cmGlobalNinjaGenerator* gg = lg->GetGlobalNinjaGenerator();
|
||||||
|
for (std::string const& cleanFile : cleanFiles) {
|
||||||
|
// Support relative paths
|
||||||
|
gg->AddAdditionalCleanFile(
|
||||||
|
cmSystemTools::CollapseFullPath(cleanFile, binaryDir));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmNinjaTargetGenerator::EnsureDirectoryExists(
|
void cmNinjaTargetGenerator::EnsureDirectoryExists(
|
||||||
const std::string& path) const
|
const std::string& path) const
|
||||||
{
|
{
|
||||||
|
@@ -134,6 +134,8 @@ protected:
|
|||||||
std::string const& objectFileDir, std::string const& flags,
|
std::string const& objectFileDir, std::string const& flags,
|
||||||
std::string const& defines, std::string const& includes);
|
std::string const& defines, std::string const& includes);
|
||||||
|
|
||||||
|
void AdditionalCleanFiles();
|
||||||
|
|
||||||
cmNinjaDeps GetObjects() const { return this->Objects; }
|
cmNinjaDeps GetObjects() const { return this->Objects; }
|
||||||
|
|
||||||
void EnsureDirectoryExists(const std::string& dir) const;
|
void EnsureDirectoryExists(const std::string& dir) const;
|
||||||
|
Reference in New Issue
Block a user