diff options
author | Alexis Murzeau <amubtdx@outlook.fr> | 2016-10-23 18:58:28 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-24 10:30:02 -0400 |
commit | e983bd326a9e3b7902d8f7cf0d891030ad3bd4c1 (patch) | |
tree | d19219a982ea8c6d7b648a29ecb2b73536bc3113 /Tests | |
parent | f660832999e086f02a9f3552c028aed900cd7249 (diff) | |
download | cmake-e983bd326a9e3b7902d8f7cf0d891030ad3bd4c1.tar.gz |
Ninja: Use binary dir for `$subdir/all` targets
The targets added by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all`
targets, 2016-03-11) use as `$subdir` the relative path from the top of
the source tree to the current source directory. This is not correct
when using `add_subdirectory(test test_bin)`. Instead we need to use
the relative path from the top of the binary tree to the current binary
directory as was done for related targets by commit v3.7.0-rc1~268^2
(Ninja: Add `$subdir/{test,install,package}` targets, 2016-08-05).
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/Ninja/RunCMakeTest.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/SubDir.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt | 6 |
6 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 446dc3c2a6..7b4e51e1f9 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -51,14 +51,23 @@ function(run_SubDir) set(SubDir_all [[SubDir\all]]) set(SubDir_test [[SubDir\test]]) set(SubDir_install [[SubDir\install]]) + set(SubDirBinary_test [[SubDirBinary\test]]) + set(SubDirBinary_all [[SubDirBinary\all]]) + set(SubDirBinary_install [[SubDirBinary\install]]) else() set(SubDir_all [[SubDir/all]]) set(SubDir_test [[SubDir/test]]) set(SubDir_install [[SubDir/install]]) + set(SubDirBinary_all [[SubDirBinary/all]]) + set(SubDirBinary_test [[SubDirBinary/test]]) + set(SubDirBinary_install [[SubDirBinary/install]]) endif() run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all}) run_cmake_command(SubDir-test ${CMAKE_COMMAND} --build . --target ${SubDir_test}) run_cmake_command(SubDir-install ${CMAKE_COMMAND} --build . --target ${SubDir_install}) + run_cmake_command(SubDirBinary-build ${CMAKE_COMMAND} --build . --target ${SubDirBinary_all}) + run_cmake_command(SubDirBinary-test ${CMAKE_COMMAND} --build . --target ${SubDirBinary_test}) + run_cmake_command(SubDirBinary-install ${CMAKE_COMMAND} --build . --target ${SubDirBinary_install}) endfunction() run_SubDir() diff --git a/Tests/RunCMake/Ninja/SubDir.cmake b/Tests/RunCMake/Ninja/SubDir.cmake index d227753b27..11f467a4be 100644 --- a/Tests/RunCMake/Ninja/SubDir.cmake +++ b/Tests/RunCMake/Ninja/SubDir.cmake @@ -1,5 +1,6 @@ include(CTest) add_subdirectory(SubDir) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/SubDirSource SubDirBinary) add_custom_target(TopFail ALL COMMAND does_not_exist) add_test(NAME TopTest COMMAND ${CMAKE_COMMAND} -E echo "Running TopTest") install(CODE [[ diff --git a/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt new file mode 100644 index 0000000000..244eaa0716 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt @@ -0,0 +1 @@ +Building SubDirSourceInAll diff --git a/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt new file mode 100644 index 0000000000..6b6c6ddbe0 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt @@ -0,0 +1 @@ +-- Installing SubDirSource diff --git a/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt new file mode 100644 index 0000000000..d6d6605ae1 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt @@ -0,0 +1 @@ +1/1 Test #1: SubDirSourceTest diff --git a/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt new file mode 100644 index 0000000000..26642610ea --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt @@ -0,0 +1,6 @@ +add_custom_target(SubDirSourceFail COMMAND does_not_exist) +add_custom_target(SubDirSourceInAll ALL COMMAND ${CMAKE_COMMAND} -E echo "Building SubDirSourceInAll") +add_test(NAME SubDirSourceTest COMMAND ${CMAKE_COMMAND} -E echo "Running SubDirSourceTest") +install(CODE [[ + message(STATUS "Installing SubDirSource") +]]) |