From d1082448a8d0a75974920690dcbad8895169bfd6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 26 Feb 2015 10:21:09 -0500 Subject: [PATCH] Tests: Extend RunCMake.CommandLine to cover 'cmake --build' for 'ninja -v' --- .../CommandLine/Build-ninja-v-stdout.txt | 1 + Tests/RunCMake/CommandLine/Build.cmake | 5 +++++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt create mode 100644 Tests/RunCMake/CommandLine/Build.cmake diff --git a/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt b/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt new file mode 100644 index 000000000..83c62ec99 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt @@ -0,0 +1 @@ +-E echo CustomCommand diff --git a/Tests/RunCMake/CommandLine/Build.cmake b/Tests/RunCMake/CommandLine/Build.cmake new file mode 100644 index 000000000..20df108ef --- /dev/null +++ b/Tests/RunCMake/CommandLine/Build.cmake @@ -0,0 +1,5 @@ +add_custom_command( + OUTPUT output.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + ) +add_custom_target(CustomTarget ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 2be6651fa..a9c49e788 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -18,6 +18,22 @@ run_cmake_command(build-no-generator run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +if(RunCMake_GENERATOR STREQUAL "Ninja") + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) + run_cmake(Build) + unset(RunCMake_TEST_OPTIONS) + run_cmake_command(Build-ninja-v ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endif() + if(UNIX) run_cmake_command(E_create_symlink-missing-dir ${CMAKE_COMMAND} -E create_symlink T missing-dir/L