diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index d9517d823..b2927a96e 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -398,6 +398,16 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( const std::vector &byproducts = ccg.GetByproducts(); cmNinjaDeps ninjaOutputs(outputs.size()+byproducts.size()), ninjaDeps; + bool symbolic = false; + for (std::vector::const_iterator o = outputs.begin(); + o != outputs.end(); ++o) + { + if (cmSourceFile* sf = this->Makefile->GetSource(*o)) + { + symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } + } + #if 0 #error TODO: Once CC in an ExternalProject target must provide the \ file of each imported target that has an add_dependencies pointing \ @@ -434,7 +444,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], cc->GetUsesTerminal(), - /*restat*/true, + /*restat*/!symbolic, ninjaOutputs, ninjaDeps, orderOnlyDeps); diff --git a/Tests/RunCMake/BuildDepends/Custom-Always.cmake b/Tests/RunCMake/BuildDepends/Custom-Always.cmake new file mode 100644 index 000000000..d412708a1 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/Custom-Always.cmake @@ -0,0 +1,24 @@ +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/before-always + COMMAND ${CMAKE_COMMAND} -E touch before-always + ) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/always + COMMAND ${CMAKE_COMMAND} -E touch always-updated + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/before-always + ) +set_property(SOURCE always PROPERTY SYMBOLIC 1) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/after-always + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/always + COMMAND ${CMAKE_COMMAND} -E touch after-always + ) + +add_custom_target(drive ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/after-always) + +file(GENERATE OUTPUT check-$>.cmake CONTENT " +set(check_pairs + \"${CMAKE_CURRENT_BINARY_DIR}/always-updated|${CMAKE_CURRENT_BINARY_DIR}/before-always\" + \"${CMAKE_CURRENT_BINARY_DIR}/after-always|${CMAKE_CURRENT_BINARY_DIR}/always-updated\" + ) +") diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index a578408e0..31c72fbe1 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -38,3 +38,5 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode") run_BuildDepends(C-Exe-Manifest) unset(run_BuildDepends_skip_step_2) endif() + +run_BuildDepends(Custom-Always)