Merge topic 'cmake--build-dir'

90ad087a cmake: Fix --build <relative-dir> for VS generators (#15609)
7195ec92 Tests: Extend RunCMake.CommandLine to cover --build with no arg
This commit is contained in:
Brad King 2015-06-16 10:39:10 -04:00 committed by CMake Topic Stage
commit e5ed8b22cb
8 changed files with 29 additions and 1 deletions

View File

@ -420,7 +420,7 @@ static int do_build(int ac, char const* const* av)
switch (doing)
{
case DoingDir:
dir = av[i];
dir = cmSystemTools::CollapseFullPath(av[i]);
doing = DoingNone;
break;
case DoingTarget:

View File

@ -0,0 +1 @@
add_subdirectory(BuildDir)

View File

@ -0,0 +1,5 @@
add_custom_command(
OUTPUT output.txt
COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
)
add_custom_target(CustomTarget ALL DEPENDS output.txt)

View File

@ -22,13 +22,30 @@ run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator)
run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P)
run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake)
run_cmake_command(build-no-dir
${CMAKE_COMMAND} --build)
run_cmake_command(build-no-cache
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
run_cmake_command(build-no-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator)
run_cmake_command(build-bad-dir
${CMAKE_COMMAND} --build dir-does-not-exist)
run_cmake_command(build-bad-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
function(run_BuildDir)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(BuildDir)
run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget)
endfunction()
run_BuildDir()
if(RunCMake_GENERATOR STREQUAL "Ninja")
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,2 @@
^Error: [^
]+/Tests/RunCMake/CommandLine/build-bad-dir-build/dir-does-not-exist is not a directory$

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
^Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\]