diff options
author | David Cole <david.cole@kitware.com> | 2011-12-20 19:21:06 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-12-20 19:21:06 (GMT) |
commit | d6a33f6d38d8989345840ddc218518fc86f3846a (patch) | |
tree | a7fc766c29dbb2eff2db66bf5c88dde6a901079e /Tests | |
parent | 16dacf3a6a85af2b0b07a4634c3b5dfbe6ece3ca (diff) | |
parent | 5badf5f734119199fa42377b25d415532191a710 (diff) | |
download | CMake-d6a33f6d38d8989345840ddc218518fc86f3846a.zip CMake-d6a33f6d38d8989345840ddc218518fc86f3846a.tar.gz CMake-d6a33f6d38d8989345840ddc218518fc86f3846a.tar.bz2 |
Merge topic 'fix_double_project_cmake_build'
5badf5f Fix the case where cmake --build failed with two project cmds in one file.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeBuildTest.cmake.in | 12 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/DoubleProject/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/DoubleProject/silly.c | 4 |
4 files changed, 23 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) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1851f7a..903bb52 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -220,11 +220,21 @@ IF(BUILD_TESTING) SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly") SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly") + SET(CMAKE_BUILD_TEST_EXE COnly) CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY) ADD_TEST(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake") LIST(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) + # now do it again for a project that has two project commands + SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/DoubleProject") + SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/DoubleProject") + SET(CMAKE_BUILD_TEST_EXE just_silly) + CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" + "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake" @ONLY) + ADD_TEST(CMakeDoubleProject ${CMAKE_CMAKE_COMMAND} -P + "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake") + LIST(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize) diff --git a/Tests/DoubleProject/CMakeLists.txt b/Tests/DoubleProject/CMakeLists.txt new file mode 100644 index 0000000..02a6275 --- /dev/null +++ b/Tests/DoubleProject/CMakeLists.txt @@ -0,0 +1,3 @@ +project(dumb) +project(dumber) +add_executable(just_silly silly.c) diff --git a/Tests/DoubleProject/silly.c b/Tests/DoubleProject/silly.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/DoubleProject/silly.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} |