summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Ninja/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-08-05 19:55:32 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-09 19:15:24 (GMT)
commit0278989405eea53ca7e5f1bfa6af9aea7a0b49c5 (patch)
treeb51f07947692aa3d95eef9299ee588061be83afc /Tests/RunCMake/Ninja/RunCMakeTest.cmake
parenta88c99f1bc301276a1780fec683d5061ca13f66f (diff)
downloadCMake-0278989405eea53ca7e5f1bfa6af9aea7a0b49c5.zip
CMake-0278989405eea53ca7e5f1bfa6af9aea7a0b49c5.tar.gz
CMake-0278989405eea53ca7e5f1bfa6af9aea7a0b49c5.tar.bz2
Ninja: Add `$subdir/{test,install,package}` targets
With the Makefile generator one can use `cd $subdir; make install` to build and install targets associated with a given subdirectory. This is not possible to do with the Ninja generator since there is only one `build.ninja` file at the top of the build tree. However, we can approximate it by allowing one to run `ninja $subdir/install` at the top of the tree to build the targets in the corresponding subdirectory and install them. This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets. It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11).
Diffstat (limited to 'Tests/RunCMake/Ninja/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index c73f852..622c327 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -41,10 +41,16 @@ function(run_SubDir)
run_cmake(SubDir)
if(WIN32)
set(SubDir_all [[SubDir\all]])
+ set(SubDir_test [[SubDir\test]])
+ set(SubDir_install [[SubDir\install]])
else()
set(SubDir_all [[SubDir/all]])
+ set(SubDir_test [[SubDir/test]])
+ set(SubDir_install [[SubDir/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})
endfunction()
run_SubDir()