diff options
author | Petr Kmoch <petr.kmoch@gmail.com> | 2013-03-28 14:10:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-04-12 15:35:36 (GMT) |
commit | ac9a5f4d943685f0b49b1a9d03f4e23238df0867 (patch) | |
tree | 7027ff81ffd0e05a7c8c119499dbfc70417ad103 /Tests | |
parent | a6c0299c407bc4482140637c0460f71238b4f9d0 (diff) | |
download | CMake-ac9a5f4d943685f0b49b1a9d03f4e23238df0867.zip CMake-ac9a5f4d943685f0b49b1a9d03f4e23238df0867.tar.gz CMake-ac9a5f4d943685f0b49b1a9d03f4e23238df0867.tar.bz2 |
ctest_build: Pass projectDir to GenerateBuildCommand
This allows the ctest_build command's TARGET option to name a target
in a subdirectory and still build properly with msbuild.
Add test case covering use of ctest_build() with such a TARGET.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4eb2f90..ad81fd6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1660,6 +1660,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" # ) + # A test for ctest_build() with targets in subdirectories + if(CMAKE_TEST_GENERATOR_TOOLSET) + set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION "-T;${CMAKE_TEST_GENERATOR_TOOLSET};") + else() + set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION) + endif() + configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY) + unset(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION) + add_test(CTest.BuildCommand.ProjectInSubdir + ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" + -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested") + set(CTEST_TEST_UPDATE 1) if(CTEST_TEST_UPDATE) # Test CTest Update with Subversion diff --git a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in new file mode 100644 index 0000000..ea48c78 --- /dev/null +++ b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8.10) + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/VSProjectInSubdir") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestBuildCommandProjectInSubdir/Nested") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_PROJECT_NAME "VSProjectInSubdir") +set(CTEST_BUILD_CONFIGURATION "@CTestTest_CONFIG@") + +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) +ctest_start(Experimental) +ctest_configure(OPTIONS "@CMAKE_TEST_GENERATOR_TOOLSET_SELECTION@-DCMAKE_MAKE_PROGRAM:FILEPATH=@CMAKE_TEST_MAKEPROGRAM@") +ctest_build(TARGET test) |