diff options
Diffstat (limited to 'Tests/RunCMake/ctest_build')
7 files changed, 33 insertions, 1 deletions
diff --git a/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt new file mode 100644 index 0000000..9cdf4a5 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt @@ -0,0 +1 @@ +(0|-1|255) diff --git a/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt new file mode 100644 index 0000000..af70ac3 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt @@ -0,0 +1,2 @@ +^(Error\(s\) when building project +)?ctest_build returned zero$ diff --git a/Tests/RunCMake/ctest_build/BuildFailure-result.txt b/Tests/RunCMake/ctest_build/BuildFailure-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_build/BuildFailure-stderr.txt b/Tests/RunCMake/ctest_build/BuildFailure-stderr.txt new file mode 100644 index 0000000..1e6ad87 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-stderr.txt @@ -0,0 +1,2 @@ +^Error\(s\) when building project +ctest_build returned non-zero$ diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in index 9ba08e9..82cb7c4 100644 --- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1) project(CTestBuild@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) +@CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 5826fe4..c6f732c 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -8,3 +8,26 @@ function(run_ctest_build CASE_NAME) endfunction() run_ctest_build(BuildQuiet QUIET) + +function(run_BuildFailure) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) +]]) + set(CASE_TEST_PREFIX_CODE [[ +cmake_policy(SET CMP0061 NEW) +]]) + set(CASE_TEST_SUFFIX_CODE [[ +if (ctest_build_return_value) + message("ctest_build returned non-zero") +else() + message("ctest_build returned zero") +endif() +]]) + run_ctest(BuildFailure) + + if (RunCMake_GENERATOR MATCHES "Makefiles") + set(CASE_TEST_PREFIX_CODE "") + run_ctest(BuildFailure-CMP0061-OLD) + endif() +endfunction() +run_BuildFailure() diff --git a/Tests/RunCMake/ctest_build/test.cmake.in b/Tests/RunCMake/ctest_build/test.cmake.in index 38c8ea1..768f1c6 100644 --- a/Tests/RunCMake/ctest_build/test.cmake.in +++ b/Tests/RunCMake/ctest_build/test.cmake.in @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.1) +@CASE_TEST_PREFIX_CODE@ set(CTEST_SITE "test-site") set(CTEST_BUILD_NAME "test-build-name") @@ -12,4 +13,5 @@ set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@") ctest_start(Experimental) ctest_configure() -ctest_build(${ctest_build_args}) +ctest_build(${ctest_build_args} RETURN_VALUE ctest_build_return_value) +@CASE_TEST_SUFFIX_CODE@ |