mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
Merge topic 'ninja-omit-empty-custom-command'
d43f4692e0
Ninja: Omit custom commands with an empty COMMAND
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5647
This commit is contained in:
@@ -557,9 +557,13 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
|
||||
std::string launcher = this->MakeCustomLauncher(ccg);
|
||||
|
||||
for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) {
|
||||
std::string c = ccg.GetCommand(i);
|
||||
if (c.empty()) {
|
||||
continue;
|
||||
}
|
||||
cmdLines.push_back(launcher +
|
||||
this->ConvertToOutputFormat(
|
||||
ccg.GetCommand(i),
|
||||
c,
|
||||
gg->IsMultiConfig() ? cmOutputConverter::NINJAMULTI
|
||||
: cmOutputConverter::SHELL));
|
||||
|
||||
|
@@ -582,3 +582,7 @@ set_target_properties(mac_fw PROPERTIES
|
||||
)
|
||||
add_custom_command(OUTPUT mac_fw.txt COMMAND ${CMAKE_COMMAND} -E touch mac_fw.txt DEPENDS mac_fw)
|
||||
add_custom_target(drive_mac_fw ALL DEPENDS mac_fw.txt)
|
||||
|
||||
# Test empty COMMANDs are ommited
|
||||
add_executable(empty_command empty_command.cxx)
|
||||
add_custom_command(TARGET empty_command POST_BUILD COMMAND $<0:date>)
|
||||
|
4
Tests/CustomCommand/empty_command.cxx
Normal file
4
Tests/CustomCommand/empty_command.cxx
Normal file
@@ -0,0 +1,4 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user