diff options
author | Brad King <brad.king@kitware.com> | 2013-03-12 22:20:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-03-12 22:20:44 (GMT) |
commit | d90f49b8948c3047cb0839ce505f796952dbd880 (patch) | |
tree | 616a2b74cad6d1690ad0809eb87d6e49ea7d6979 /Tests | |
parent | 2e1c2bd2dd97e426944d6ac18e4073ec26ddf64c (diff) | |
download | CMake-d90f49b8948c3047cb0839ce505f796952dbd880.zip CMake-d90f49b8948c3047cb0839ce505f796952dbd880.tar.gz CMake-d90f49b8948c3047cb0839ce505f796952dbd880.tar.bz2 |
CTest: Fail early without PROJECT_BINARY_DIR (#14005)
Do not use PROJECT_BINARY_DIR before it is defined. If it is not
defined when needed, fail with an error message suggesting that the
project() command be invoked first.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/BeforeProject-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/BeforeProject-stderr.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/BeforeProject.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/RunCMakeTest.cmake | 5 |
6 files changed, 20 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index dba772d..4b4bd31 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -52,6 +52,7 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) endif() add_RunCMake_test(CMP0019) +add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) endif() diff --git a/Tests/RunCMake/CTest/BeforeProject-result.txt b/Tests/RunCMake/CTest/BeforeProject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTest/BeforeProject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTest/BeforeProject-stderr.txt b/Tests/RunCMake/CTest/BeforeProject-stderr.txt new file mode 100644 index 0000000..354896b --- /dev/null +++ b/Tests/RunCMake/CTest/BeforeProject-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/CTest.cmake:[0-9]+ \(build_command\): + build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) + or enable_language\(\) first. +Call Stack \(most recent call first\): + BeforeProject.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CTest/BeforeProject.cmake b/Tests/RunCMake/CTest/BeforeProject.cmake new file mode 100644 index 0000000..903ca69 --- /dev/null +++ b/Tests/RunCMake/CTest/BeforeProject.cmake @@ -0,0 +1,2 @@ +include(CTest) +project(${RunCMake_TEST} NONE) diff --git a/Tests/RunCMake/CTest/CMakeLists.txt b/Tests/RunCMake/CTest/CMakeLists.txt new file mode 100644 index 0000000..f6e84c0 --- /dev/null +++ b/Tests/RunCMake/CTest/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8) +if(NOT NoProject) + project(${RunCMake_TEST} NONE) +endif() +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake new file mode 100644 index 0000000..a6f6842 --- /dev/null +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS -DNoProject=1) +run_cmake(BeforeProject) +unset(RunCMake_TEST_OPTIONS) |