diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-01-24 18:31:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-28 15:01:55 (GMT) |
commit | 66801f4d40227c46904ad54848bd1da959604cbf (patch) | |
tree | 093864fcadfbf95b7adea9d2bd21e2047894fc7f /Tests/RunCMake | |
parent | 439fe2e253410305ff7018416ff5ff26aa851d53 (diff) | |
download | CMake-66801f4d40227c46904ad54848bd1da959604cbf.zip CMake-66801f4d40227c46904ad54848bd1da959604cbf.tar.gz CMake-66801f4d40227c46904ad54848bd1da959604cbf.tar.bz2 |
cmake: Add tests for verbose output to --build mode
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Make/RunCMakeTest.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/Make/VerboseBuild-build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Make/VerboseBuild.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/Make/hello.c | 7 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/RunCMakeTest.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/VerboseBuild.cmake | 3 |
11 files changed, 50 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bf18efe..76dd997 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -123,7 +123,7 @@ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") add_RunCMake_test(CMP0065) endif() if(CMAKE_GENERATOR MATCHES "Make") - add_RunCMake_test(Make) + add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU}) endif() if(CMAKE_GENERATOR STREQUAL "Ninja") set(Ninja_ARGS diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index 3b2b8f5..82db6b7 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -16,5 +16,22 @@ run_TargetMessages(OFF) run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON) run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF) +function(run_VerboseBuild) + run_cmake(VerboseBuild) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build) + if(RunCMake_GENERATOR STREQUAL "Watcom WMake") + # wmake does not actually show the verbose output. + set(RunCMake-stdout-file VerboseBuild-build-watcom-stdout.txt) + endif() + run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) + unset(RunCMake-stdout-file) + if(MAKE_IS_GNU) + set(RunCMake-stdout-file VerboseBuild-nowork-gnu-stdout.txt) + endif() + run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) +endfunction() +run_VerboseBuild() + run_cmake(CustomCommandDepfile-ERROR) run_cmake(IncludeRegexSubdir) diff --git a/Tests/RunCMake/Make/VerboseBuild-build-stdout.txt b/Tests/RunCMake/Make/VerboseBuild-build-stdout.txt new file mode 100644 index 0000000..884bf95 --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild-build-stdout.txt @@ -0,0 +1 @@ +.*DEFINE_FOR_VERBOSE_DETECTION.*hello.dir.* diff --git a/Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt b/Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt new file mode 100644 index 0000000..9c558e3 --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt @@ -0,0 +1 @@ +. diff --git a/Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt b/Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt new file mode 100644 index 0000000..3e65cd9 --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt @@ -0,0 +1 @@ +.*Nothing to be done for.*hello.* diff --git a/Tests/RunCMake/Make/VerboseBuild.cmake b/Tests/RunCMake/Make/VerboseBuild.cmake new file mode 100644 index 0000000..70a971d --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +# Make sure compile command is not hidden in a temp file. +string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}") +string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}") + +add_executable(hello hello.c) +target_compile_definitions(hello PRIVATE "DEFINE_FOR_VERBOSE_DETECTION") diff --git a/Tests/RunCMake/Make/hello.c b/Tests/RunCMake/Make/hello.c new file mode 100644 index 0000000..aac8b4e --- /dev/null +++ b/Tests/RunCMake/Make/hello.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(void) +{ + printf("Hello world!\n"); + return 0; +} diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 9e1e9a5..8fa650a 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -30,6 +30,15 @@ function(run_NoWorkToDo) endfunction() run_NoWorkToDo() +function(run_VerboseBuild) + run_cmake(VerboseBuild) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build) + run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) + run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) +endfunction() +run_VerboseBuild() + function(run_CMP0058 case) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) diff --git a/Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt b/Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt new file mode 100644 index 0000000..884bf95 --- /dev/null +++ b/Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt @@ -0,0 +1 @@ +.*DEFINE_FOR_VERBOSE_DETECTION.*hello.dir.* diff --git a/Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt b/Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt new file mode 100644 index 0000000..60a9228 --- /dev/null +++ b/Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt @@ -0,0 +1 @@ +^ninja: no work to do diff --git a/Tests/RunCMake/Ninja/VerboseBuild.cmake b/Tests/RunCMake/Ninja/VerboseBuild.cmake new file mode 100644 index 0000000..424e54e --- /dev/null +++ b/Tests/RunCMake/Ninja/VerboseBuild.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(hello hello.c) +target_compile_definitions(hello PRIVATE "DEFINE_FOR_VERBOSE_DETECTION") |