Skip to content

Commit

Permalink
Merge branch 'ninja-restat-custom-command-byproducts' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bradking committed Apr 5, 2016
2 parents 4ffd85c + add7abc commit 9729dfb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/cmLocalNinjaGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(

bool symbolic = false;
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o)
!symbolic && o != outputs.end(); ++o)
{
if (cmSourceFile* sf = this->Makefile->GetSource(*o))
{
Expand Down Expand Up @@ -444,7 +444,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
this->ConstructComment(ccg),
"Custom command for " + ninjaOutputs[0],
cc->GetUsesTerminal(),
/*restat*/!symbolic,
/*restat*/!symbolic || !byproducts.empty(),
ninjaOutputs,
ninjaDeps,
orderOnlyDeps);
Expand Down
28 changes: 28 additions & 0 deletions Tests/RunCMake/BuildDepends/Custom-Symbolic-and-Byproduct.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
add_custom_command(
OUTPUT gen-byproduct gen-byproduct-stamp
BYPRODUCTS byproduct
COMMAND ${CMAKE_COMMAND} -E touch gen-byproduct-stamp
COMMAND ${CMAKE_COMMAND} -E copy_if_different gen-byproduct-stamp byproduct
)
set_property(SOURCE gen-byproduct PROPERTY SYMBOLIC 1)
add_custom_target(produce DEPENDS gen-byproduct)

add_custom_command(
OUTPUT use-byproduct
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/byproduct
COMMAND ${CMAKE_COMMAND} -E touch use-byproduct
)
add_custom_target(drive ALL DEPENDS use-byproduct)
add_dependencies(drive produce)

file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
if (check_step EQUAL 1)
set(check_pairs
\"${CMAKE_CURRENT_BINARY_DIR}/use-byproduct|${CMAKE_CURRENT_BINARY_DIR}/gen-byproduct-stamp\"
)
else()
set(check_pairs
\"${CMAKE_CURRENT_BINARY_DIR}/gen-byproduct-stamp|${CMAKE_CURRENT_BINARY_DIR}/use-byproduct\"
)
endif()
")
1 change: 1 addition & 0 deletions Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode")
unset(run_BuildDepends_skip_step_2)
endif()

run_BuildDepends(Custom-Symbolic-and-Byproduct)
run_BuildDepends(Custom-Always)

0 comments on commit 9729dfb

Please sign in to comment.