mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-22 15:10:20 -06:00
add_custom_command: Add CODEGEN support
By specifying CODEGEN as an argument to add_custom_command the custom command will be added to a codegen build target. The intent is to provide a convenient way for users to get their generated files without having to build the whole project. This can be helpful for code analysis tools which can be useful for IDEs and CI.
This commit is contained in:
@@ -1763,6 +1763,21 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||
this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends,
|
||||
commands, true);
|
||||
|
||||
// Write the codegen rule.
|
||||
if (this->GetGlobalGenerator()->CheckCMP0171()) {
|
||||
recursiveTarget = cmStrCat(this->GetCurrentBinaryDirectory(), "/codegen");
|
||||
depends.clear();
|
||||
commands.clear();
|
||||
if (regenerate) {
|
||||
depends.emplace_back("cmake_check_build_system");
|
||||
}
|
||||
commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget));
|
||||
AppendEcho(commands, "Finished generating code",
|
||||
cmLocalUnixMakefileGenerator3::EchoColor::EchoGenerate);
|
||||
this->WriteMakeRule(ruleFileStream, "The main codegen target", "codegen",
|
||||
depends, commands, true);
|
||||
}
|
||||
|
||||
// Write the clean rule.
|
||||
recursiveTarget = cmStrCat(this->GetCurrentBinaryDirectory(), "/clean");
|
||||
commands.clear();
|
||||
|
||||
Reference in New Issue
Block a user