Browse Source

Merge topic 'ninja-custom-target-build-event-dollar'

c3c14f04f2 Ninja: Fix build event commands with $-sign on custom targets

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !9662
Brad King 1 year ago
parent
commit
89dc9a6c41
2 changed files with 4 additions and 4 deletions
  1. 0 4
      Source/cmNinjaUtilityTargetGenerator.cxx
  2. 4 0
      Tests/CustomCommand/CMakeLists.txt

+ 0 - 4
Source/cmNinjaUtilityTargetGenerator.cxx

@@ -161,10 +161,6 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
     cmSystemTools::ReplaceString(command, "$(ARGS)", "");
     command = gg->ExpandCFGIntDir(command, config);
 
-    if (command.find('$') != std::string::npos) {
-      return;
-    }
-
     std::string ccConfig;
     if (genTarget->Target->IsPerConfig() &&
         genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {

+ 4 - 0
Tests/CustomCommand/CMakeLists.txt

@@ -412,6 +412,10 @@ add_custom_target(do_check_command_line ALL
   COMMENT "Checking custom target command line escapes ($dollar-signs$)"
   )
 add_dependencies(do_check_command_line check_command_line)
+add_custom_command(TARGET do_check_command_line POST_BUILD VERBATIM
+  COMMAND ${CMAKE_COMMAND} -E echo "POST_BUILD command with $dollar-signs$"
+  COMMENT "Checking custom target POST_BUILD command line escapes ($dollar-signs$)"
+)
 
 add_custom_target(pre_check_command_line
   COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt