summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-09-06 14:13:39 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2018-09-15 15:25:47 (GMT)
commita10d63d5783275f9972aaa86d41071a1ddca7921 (patch)
treef1791bda0cccaaec3cd53e19e3e82cf68b44e197 /Tests
parent6d2a2fe66027b6eeb2817a8e667894ad2e233d03 (diff)
downloadCMake-a10d63d5783275f9972aaa86d41071a1ddca7921.zip
CMake-a10d63d5783275f9972aaa86d41071a1ddca7921.tar.gz
CMake-a10d63d5783275f9972aaa86d41071a1ddca7921.tar.bz2
cmake: -S and -B can be used to specify source and build directories
Document the previously internal option of '-B' and provide a matching source directory option with '-S'. Both '-B', and '-S' can be used independently of each other.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg2-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt8
-rw-r--r--Tests/RunCMake/CommandLine/NoArgs-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg2-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt1
11 files changed, 42 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/B-no-arg-result.txt b/Tests/RunCMake/CommandLine/B-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt
new file mode 100644
index 0000000..2309c5e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No build directory specified for -B
diff --git a/Tests/RunCMake/CommandLine/B-no-arg2-result.txt b/Tests/RunCMake/CommandLine/B-no-arg2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt b/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt
new file mode 100644
index 0000000..2309c5e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No build directory specified for -B
diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
new file mode 100644
index 0000000..0ca5a0a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+add_custom_command(
+ OUTPUT output.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ )
+add_custom_target(CustomTarget ALL DEPENDS output.txt)
+add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
diff --git a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt
index 1cd3469..f1dafc8 100644
--- a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt
+++ b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt
@@ -2,6 +2,7 @@
cmake \[options\] <path-to-source>
cmake \[options\] <path-to-existing-build>
+ cmake \[options\] -S <path-to-source> -B <path-to-build>
Specify a source directory to \(re-\)generate a build system for it in the
current working directory. Specify an existing build directory to
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index cef2b9b..e332336 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -48,6 +48,31 @@ run_cmake_command(cache-bad-entry
run_cmake_command(cache-empty-entry
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/)
+function(run_ExplicitDirs)
+ set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
+ set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
+
+ file(REMOVE_RECURSE "${binary_dir}")
+ file(MAKE_DIRECTORY "${binary_dir}")
+ run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir})
+ run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} )
+ run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S )
+ run_cmake_command(S-no-arg2 ${CMAKE_COMMAND} -S -T)
+ run_cmake_command(S-B ${CMAKE_COMMAND} -S ${source_dir} -B ${binary_dir})
+
+ # make sure that -B can explicitly construct build directories
+ file(REMOVE_RECURSE "${binary_dir}")
+ run_cmake_command(B-arg ${CMAKE_COMMAND} -B ${binary_dir} ${source_dir})
+ file(REMOVE_RECURSE "${binary_dir}")
+ run_cmake_command(B-arg-reverse-order ${CMAKE_COMMAND} ${source_dir} -B${binary_dir})
+ run_cmake_command(B-no-arg ${CMAKE_COMMAND} -B )
+ run_cmake_command(B-no-arg2 ${CMAKE_COMMAND} -B -T)
+ file(REMOVE_RECURSE "${binary_dir}")
+ run_cmake_command(B-S ${CMAKE_COMMAND} -B${binary_dir} -S${source_dir})
+
+endfunction()
+run_ExplicitDirs()
+
function(run_BuildDir)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build)
diff --git a/Tests/RunCMake/CommandLine/S-no-arg-result.txt b/Tests/RunCMake/CommandLine/S-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt
new file mode 100644
index 0000000..d1a2ce3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No source directory specified for -S
diff --git a/Tests/RunCMake/CommandLine/S-no-arg2-result.txt b/Tests/RunCMake/CommandLine/S-no-arg2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt b/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt
new file mode 100644
index 0000000..d1a2ce3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No source directory specified for -S