summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeBuildTest.cmake.in
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2011-12-16 02:56:34 (GMT)
committerBrad King <brad.king@kitware.com>2011-12-20 19:16:25 (GMT)
commit5badf5f734119199fa42377b25d415532191a710 (patch)
treeb942dab683f4312cd67176b436b710859b5e55a2 /Tests/CMakeBuildTest.cmake.in
parent0a6543d957463f0a7f7a585cc43468174c1204a0 (diff)
downloadCMake-5badf5f734119199fa42377b25d415532191a710.zip
CMake-5badf5f734119199fa42377b25d415532191a710.tar.gz
CMake-5badf5f734119199fa42377b25d415532191a710.tar.bz2
Fix the case where cmake --build failed with two project cmds in one file.
This adds a test that uses two project commands in the same CMakeLists.txt file. It also adds a fix so that cmake --build will work in that case. The fix sets the name of the last project command in the top level CMakeLists.txt in the cache variable CMAKE_PROJECT_NAME. This variable is used by cmake --build to find the project name.
Diffstat (limited to 'Tests/CMakeBuildTest.cmake.in')
-rw-r--r--Tests/CMakeBuildTest.cmake.in12
1 files changed, 6 insertions, 6 deletions
diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in
index 9c3002b..a8bb750 100644
--- a/Tests/CMakeBuildTest.cmake.in
+++ b/Tests/CMakeBuildTest.cmake.in
@@ -32,21 +32,21 @@ set(CMAKE_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
# run the executable out of the Debug directory if there
# are configuration types
if(CMAKE_CONFIGURATION_TYPES)
- set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/COnly")
+ set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/@CMAKE_BUILD_TEST_EXE@")
else(CMAKE_CONFIGURATION_TYPES)
- set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/COnly")
+ set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/@CMAKE_BUILD_TEST_EXE@")
endif(CMAKE_CONFIGURATION_TYPES)
# run the test results
message("running [${RUN_TEST}]")
execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT)
if(RESULT)
- message(FATAL_ERROR "Error running test COnly")
+ message(FATAL_ERROR "Error running test @CMAKE_BUILD_TEST_EXE@")
endif(RESULT)
-# build it again with clean and only COnly target
+# build it again with clean and only @CMAKE_BUILD_TEST_EXE@ target
execute_process(COMMAND "${CMAKE_COMMAND}"
--build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug
- --clean-first --target COnly
+ --clean-first --target @CMAKE_BUILD_TEST_EXE@
RESULT_VARIABLE RESULT)
if(RESULT)
message(FATAL_ERROR "Error running cmake --build")
@@ -55,5 +55,5 @@ endif(RESULT)
# run it again after clean
execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT)
if(RESULT)
- message(FATAL_ERROR "Error running test COnly after clean ")
+ message(FATAL_ERROR "Error running test @CMAKE_BUILD_TEST_EXE@ after clean ")
endif(RESULT)