[Cmake-commits] CMake branch, master, updated. v3.12.2-673-ga9df54e
Kitware Robot
kwrobot at kitware.com
Wed Sep 19 10:45:09 EDT 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via a9df54ec313cf832a30f7aab0180a74d114ee5b5 (commit)
via ec9ef691feab1ae8fc4209330af91169b4faa076 (commit)
via c0cedaa6435d2eb1a49afab1eaa08ba3cd40290e (commit)
via afb7f6e4ff8a0c1a68c8d8cf2d6cf72401cfb8ff (commit)
via 7f530cc54e070257ea0a59ea4f63ab6f34bcf878 (commit)
via 638f00117a8166702950a6c730fdfa453f788659 (commit)
via de962cc00d66a5303e42ba7ea2311b131eaefe18 (commit)
via a10d63d5783275f9972aaa86d41071a1ddca7921 (commit)
from 76a19eb6c16272e4600267aed6ed7aff0fd9c765 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9df54ec313cf832a30f7aab0180a74d114ee5b5
commit a9df54ec313cf832a30f7aab0180a74d114ee5b5
Merge: ec9ef69 afb7f6e
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 19 14:40:58 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 19 10:41:07 2018 -0400
Merge topic 'symlink'
afb7f6e4ff cmake: Add '-E create_symlink' support on Windows
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2144
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec9ef691feab1ae8fc4209330af91169b4faa076
commit ec9ef691feab1ae8fc4209330af91169b4faa076
Merge: c0cedaa 638f001
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 19 14:38:11 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 19 10:38:19 2018 -0400
Merge topic 'provide_explicit_source_and_build_command_line_options'
638f00117a Add release note for the -S and -B options.
de962cc00d CMake: Internally uses -S instead of -H to specify source directory
a10d63d578 cmake: -S and -B can be used to specify source and build directories
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2358
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0cedaa6435d2eb1a49afab1eaa08ba3cd40290e
commit c0cedaa6435d2eb1a49afab1eaa08ba3cd40290e
Merge: 76a19eb 7f530cc
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 19 14:36:05 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 19 10:36:11 2018 -0400
Merge topic 'ctest-more_submit_params'
7f530cc54e ctest_submit: pass additional info to CDash
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2380
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afb7f6e4ff8a0c1a68c8d8cf2d6cf72401cfb8ff
commit afb7f6e4ff8a0c1a68c8d8cf2d6cf72401cfb8ff
Author: Jon Chronopoulos <patches at crondog.com>
AuthorDate: Mon Jun 11 17:28:09 2018 +1000
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Sep 18 11:24:08 2018 -0400
cmake: Add '-E create_symlink' support on Windows
The allows `-E create_symlink` to work on Windows. It utilizes
`uv_fs_symlink`. I am still unsure exactly which Windows platforms will
work without requiring Administrator privileges or needing a user/group
with the "Create Symbolic Links" User Rights. It does work with my
Windows 10 Pro with Developer Mode turned on. In the test suite check
that the symlink either worked or failed with a permissions error.
Use recent changes in cmSystemTools::FileExists to check that a symlink
is broken.
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 177acd4..00d95ce 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -353,11 +353,6 @@ Available commands are:
Touch a file if it exists but do not create it. If a file does
not exist it will be silently ignored.
-UNIX-specific Command-Line Tools
---------------------------------
-
-The following ``cmake -E`` commands are available only on UNIX:
-
``create_symlink <old> <new>``
Create a symbolic link ``<new>`` naming ``<old>``.
diff --git a/Help/release/dev/create_symlink-windows.rst b/Help/release/dev/create_symlink-windows.rst
new file mode 100644
index 0000000..e3ea491
--- /dev/null
+++ b/Help/release/dev/create_symlink-windows.rst
@@ -0,0 +1,5 @@
+create_symlink-windows
+-------------------------
+
+* The :manual:`cmake(1)` ``-E create_symlink`` command can now be used
+ on Windows.
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 79e5ccf..8339aac 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -6,6 +6,7 @@
#include "cmDuration.h"
#include "cmProcessOutput.h"
#include "cm_sys_stat.h"
+#include "cm_uv.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmArchiveWrite.h"
@@ -55,8 +56,6 @@
# include <wincrypt.h>
# include <fcntl.h> /* _O_TEXT */
-
-# include "cm_uv.h"
#else
# include <sys/time.h>
# include <unistd.h>
@@ -2988,3 +2987,25 @@ bool cmSystemTools::StringToULong(const char* str, unsigned long* value)
*value = strtoul(str, &endp, 10);
return (*endp == '\0') && (endp != str) && (errno == 0);
}
+
+bool cmSystemTools::CreateSymlink(const std::string& origName,
+ const std::string& newName)
+{
+ uv_fs_t req;
+ int flags = 0;
+#if defined(_WIN32)
+ if (cmsys::SystemTools::FileIsDirectory(origName)) {
+ flags |= UV_FS_SYMLINK_DIR;
+ }
+#endif
+ int err = uv_fs_symlink(nullptr, &req, origName.c_str(), newName.c_str(),
+ flags, nullptr);
+ if (err) {
+ std::string e =
+ "failed to create symbolic link '" + newName + "': " + uv_strerror(err);
+ cmSystemTools::Error(e.c_str());
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 5c383ee..98300eb 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -513,6 +513,11 @@ public:
/** Perform one-time initialization of libuv. */
static void InitializeLibUV();
+ /** Create a symbolic link if the platform supports it. Returns whether
+ creation succeeded. */
+ static bool CreateSymlink(const std::string& origName,
+ const std::string& newName);
+
private:
static bool s_ForceUnixPaths;
static bool s_RunCommandHideConsole;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 87da108..1d2f741 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -108,6 +108,7 @@ void CMakeCommandUsage(const char* program)
<< " time command [args...] - run command and display elapsed time\n"
<< " touch file - touch a file.\n"
<< " touch_nocreate file - touch a file but do not create it.\n"
+ << " create_symlink old new - create a symbolic link new -> old\n"
#if defined(_WIN32) && !defined(__CYGWIN__)
<< "Available on Windows only:\n"
<< " delete_regv key - delete registry value\n"
@@ -116,9 +117,6 @@ void CMakeCommandUsage(const char* program)
<< " env_vs9_wince sdkname - displays a batch file which sets the "
"environment for the provided Windows CE SDK installed in VS2008\n"
<< " write_regv key value - write registry value\n"
-#else
- << "Available on UNIX only:\n"
- << " create_symlink old new - create a symbolic link new -> old\n"
#endif
;
/* clang-format on */
@@ -868,9 +866,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1;
}
if (!cmSystemTools::CreateSymlink(args[2], args[3])) {
- std::string emsg = cmSystemTools::GetLastSystemError();
- std::cerr << "failed to create symbolic link '" << destinationFileName
- << "': " << emsg << "\n";
return 1;
}
return 0;
diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake
index d7e652d..5df5f2f 100644
--- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake
+++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake
@@ -1,6 +1,10 @@
-if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L)
- set(RunCMake_TEST_FAILED "Symlink 'L' incorrectly not created!")
-endif()
-if(EXISTS ${RunCMake_TEST_BINARY_DIR}/L)
- set(RunCMake_TEST_FAILED "Symlink 'L' not broken!")
+if(${actual_stderr_var} MATCHES "operation not permitted")
+ unset(msg)
+else()
+ if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L)
+ set(RunCMake_TEST_FAILED "Symlink 'L' incorrectly not created!")
+ endif()
+ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/L)
+ set(RunCMake_TEST_FAILED "Symlink 'L' not broken!")
+ endif()
endif()
diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake
index c078ae8..d37df01 100644
--- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake
+++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake
@@ -1,3 +1,7 @@
-if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L)
- set(RunCMake_TEST_FAILED "Symlink 'L' not replaced correctly!")
+if(${actual_stderr_var} MATCHES "operation not permitted")
+ unset(msg)
+else()
+ if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L)
+ set(RunCMake_TEST_FAILED "Symlink 'L' not replaced correctly!")
+ endif()
endif()
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index cef2b9b..5c80281 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -102,32 +102,35 @@ if(RunCMake_GENERATOR STREQUAL "Ninja")
unset(RunCMake_TEST_NO_CLEAN)
endif()
-if(UNIX)
- run_cmake_command(E_create_symlink-no-arg
- ${CMAKE_COMMAND} -E create_symlink
- )
- run_cmake_command(E_create_symlink-missing-dir
- ${CMAKE_COMMAND} -E create_symlink T missing-dir/L
- )
+run_cmake_command(E_create_symlink-no-arg
+ ${CMAKE_COMMAND} -E create_symlink
+ )
+run_cmake_command(E_create_symlink-missing-dir
+ ${CMAKE_COMMAND} -E create_symlink T missing-dir/L
+ )
- # Use a single build tree for a few tests without cleaning.
- set(RunCMake_TEST_BINARY_DIR
- ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build)
- set(RunCMake_TEST_NO_CLEAN 1)
- file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
- run_cmake_command(E_create_symlink-broken-create
- ${CMAKE_COMMAND} -E create_symlink T L
- )
- run_cmake_command(E_create_symlink-broken-replace
- ${CMAKE_COMMAND} -E create_symlink . L
- )
- unset(RunCMake_TEST_BINARY_DIR)
- unset(RunCMake_TEST_NO_CLEAN)
+# Use a single build tree for a few tests without cleaning.
+# These tests are special on Windows since it will only fail if the user
+# running the test does not have the priveldge to create symlinks. If this
+# happens we clear the msg in the -check.cmake and say that the test passes
+set(RunCMake_DEFAULT_stderr "(operation not permitted)?")
+set(RunCMake_TEST_BINARY_DIR
+ ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build)
+set(RunCMake_TEST_NO_CLEAN 1)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+run_cmake_command(E_create_symlink-broken-create
+ ${CMAKE_COMMAND} -E create_symlink T L
+ )
+run_cmake_command(E_create_symlink-broken-replace
+ ${CMAKE_COMMAND} -E create_symlink . L
+ )
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_DEFAULT_stderr)
- run_cmake_command(E_create_symlink-no-replace-dir
- ${CMAKE_COMMAND} -E create_symlink T .
- )
-endif()
+run_cmake_command(E_create_symlink-no-replace-dir
+ ${CMAKE_COMMAND} -E create_symlink T .
+ )
set(in ${RunCMake_SOURCE_DIR}/copy_input)
set(out ${RunCMake_BINARY_DIR}/copy_output)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f530cc54e070257ea0a59ea4f63ab6f34bcf878
commit 7f530cc54e070257ea0a59ea4f63ab6f34bcf878
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Wed Sep 12 10:39:25 2018 -0400
Commit: Zack Galbreath <zack.galbreath at kitware.com>
CommitDate: Mon Sep 17 10:38:33 2018 -0400
ctest_submit: pass additional info to CDash
Specify buildname, site, and buildstamp to CDash upon submission.
CDash will use this extra info to assign and report back a buildid.
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index cbed40e..c7f3f39 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -425,6 +425,29 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
((url.find('?') == std::string::npos) ? '?' : '&') +
"FileName=" + ofile;
+ cmCTestCurl ctest_curl(this->CTest);
+ upload_as += "&build=";
+ upload_as +=
+ ctest_curl.Escape(this->CTest->GetCTestConfiguration("BuildName"));
+ upload_as += "&site=";
+ upload_as +=
+ ctest_curl.Escape(this->CTest->GetCTestConfiguration("Site"));
+ upload_as += "&stamp=";
+ upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
+ upload_as += "-";
+ upload_as += ctest_curl.Escape(this->CTest->GetTestModelString());
+ cmCTestScriptHandler* ch =
+ static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script"));
+ cmake* cm = ch->GetCMake();
+ if (cm) {
+ const char* subproject =
+ cm->GetState()->GetGlobalProperty("SubProject");
+ if (subproject) {
+ upload_as += "&subproject=";
+ upload_as += ctest_curl.Escape(subproject);
+ }
+ }
+
upload_as += "&MD5=";
if (cmSystemTools::IsOn(this->GetOption("InternalTest"))) {
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
new file mode 100644
index 0000000..a8f10b5
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
@@ -0,0 +1 @@
+ *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
new file mode 100644
index 0000000..11a4edf
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
@@ -0,0 +1 @@
+Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___Configure.xml&build=test-build-name&site=test-site&stamp=.*-Experimental&subproject=mysubproj&MD5=.* Size: .*
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index ed0e666..7661383 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -30,6 +30,7 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
run_ctest_submit(CDashSubmitQuiet QUIET)
+run_ctest_submit_debug(CDashSubmitVerbose)
run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")
diff --git a/Tests/RunCMake/ctest_submit/test.cmake.in b/Tests/RunCMake/ctest_submit/test.cmake.in
index ba826f1..35cd16a 100644
--- a/Tests/RunCMake/ctest_submit/test.cmake.in
+++ b/Tests/RunCMake/ctest_submit/test.cmake.in
@@ -9,6 +9,7 @@ set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+set_property(GLOBAL PROPERTY SubProject "mysubproj")
ctest_start(Experimental)
ctest_configure()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=638f00117a8166702950a6c730fdfa453f788659
commit 638f00117a8166702950a6c730fdfa453f788659
Author: Robert Maynard <robert.maynard at kitware.com>
AuthorDate: Sat Sep 8 17:28:03 2018 -0400
Commit: Robert Maynard <robert.maynard at kitware.com>
CommitDate: Sat Sep 15 11:25:47 2018 -0400
Add release note for the -S and -B options.
diff --git a/Help/release/dev/cmake-explicit-dirs.rst b/Help/release/dev/cmake-explicit-dirs.rst
new file mode 100644
index 0000000..35f2d3a
--- /dev/null
+++ b/Help/release/dev/cmake-explicit-dirs.rst
@@ -0,0 +1,10 @@
+cmake-explicit-dirs
+-------------------
+
+* The :manual:`cmake <cmake(1)>` command gained the ``-S <source_dir>``
+ command line option to specify the location of the source directory.
+ This option can be used independently of ``-B``.
+
+* The :manual:`cmake <cmake(1)>` command gained the ``-B <build_dir>``
+ command line option to specify the location of the build directory.
+ This option can be used independently of ``-S``.
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de962cc00d66a5303e42ba7ea2311b131eaefe18
commit de962cc00d66a5303e42ba7ea2311b131eaefe18
Author: Robert Maynard <robert.maynard at kitware.com>
AuthorDate: Thu Sep 6 13:02:09 2018 -0400
Commit: Robert Maynard <robert.maynard at kitware.com>
CommitDate: Sat Sep 15 11:25:47 2018 -0400
CMake: Internally uses -S instead of -H to specify source directory
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 2646c9a..7b980a0 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -150,7 +150,7 @@ int main(int argc, char** argv)
typedef cmsys::CommandLineArguments argT;
arg.AddArgument("-B", argT::CONCAT_ARGUMENT, &binaryDirectory,
"Binary Directory");
- arg.AddArgument("-H", argT::CONCAT_ARGUMENT, &sourceDirectory,
+ arg.AddArgument("-S", argT::CONCAT_ARGUMENT, &sourceDirectory,
"Source Directory");
// do not complain about unknown options
arg.StoreUnusedArguments(true);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 92ede7f..34c5db7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2430,7 +2430,7 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache(
std::string edit_cmd = this->GetEditCacheCommand();
if (!edit_cmd.empty()) {
singleLine.push_back(std::move(edit_cmd));
- singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
+ singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.Message = "Running CMake cache editor...";
gti.UsesTerminal = true;
@@ -2460,7 +2460,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
gti.UsesTerminal = true;
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
- singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
+ singleLine.push_back("-S$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
gti.CommandLines.push_back(std::move(singleLine));
targets.push_back(std::move(gti));
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0c80910..a21d6dc 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1340,7 +1340,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
std::ostringstream cmd;
cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
cmOutputConverter::SHELL)
- << " -H"
+ << " -S"
<< lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
cmOutputConverter::SHELL)
<< " -B"
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 117d051..ba138c2 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -177,9 +177,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// Create a rule to re-run CMake.
cmCustomCommandLine commandLine;
commandLine.push_back(cmSystemTools::GetCMakeCommand());
- std::string argH = "-H";
- argH += lg->GetSourceDirectory();
- commandLine.push_back(argH);
+ std::string argS = "-S";
+ argS += lg->GetSourceDirectory();
+ commandLine.push_back(argS);
std::string argB = "-B";
argB += lg->GetBinaryDirectory();
commandLine.push_back(argB);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index bc83ce2..8820042 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -773,7 +773,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
std::string cmakefileName = cmake::GetCMakeFilesDirectoryPostSlash();
cmakefileName += "Makefile.cmake";
std::string runRule =
- "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
+ "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
runRule +=
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL);
@@ -1684,7 +1684,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
cmakefileName += "Makefile.cmake";
{
std::string runRule =
- "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
+ "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
runRule +=
this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 80f2803..d3a1fa1 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -260,7 +260,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
std::string comment = "Building Custom Rule ";
comment += makefileIn;
std::string args;
- args = "-H";
+ args = "-S";
args += this->GetSourceDirectory();
commandLine.push_back(args);
args = "-B";
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a10d63d5783275f9972aaa86d41071a1ddca7921
commit a10d63d5783275f9972aaa86d41071a1ddca7921
Author: Robert Maynard <robert.maynard at kitware.com>
AuthorDate: Thu Sep 6 10:13:39 2018 -0400
Commit: Robert Maynard <robert.maynard at kitware.com>
CommitDate: Sat Sep 15 11:25:47 2018 -0400
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.
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index 33d27af..baa73d5 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -1,3 +1,11 @@
+``-S <path-to-source>``
+ Path to root directory of the CMake project to build.
+
+``-B <path-to-build>``
+ Path to directory which CMake will use as the root of build directory.
+
+ If the directory doesn't already exist CMake will make it.
+
``-C <initial-cache>``
Pre-load a script to populate the cache.
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 177acd4..9fe0c0b 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -9,6 +9,7 @@ Synopsis
.. parsed-literal::
cmake [<options>] {<path-to-source> | <path-to-existing-build>}
+ cmake [<options>] -S <path-to-source> -B <path-to-build>
cmake [{-D <var>=<value>}...] -P <cmake-script-file>
cmake --build <dir> [<options>...] [-- <build-tool-options>...]
cmake --open <dir>
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1bf8f7d..68e4506 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -611,19 +611,43 @@ void cmake::SetArgs(const std::vector<std::string>& args,
bool havePlatform = false;
for (unsigned int i = 1; i < args.size(); ++i) {
std::string const& arg = args[i];
- if (arg.find("-H", 0) == 0) {
+ if (arg.find("-H", 0) == 0 || arg.find("-S", 0) == 0) {
directoriesSet = true;
std::string path = arg.substr(2);
+ if (path.empty()) {
+ ++i;
+ if (i >= args.size()) {
+ cmSystemTools::Error("No source directory specified for -S");
+ return;
+ }
+ path = args[i];
+ if (path[0] == '-') {
+ cmSystemTools::Error("No source directory specified for -S");
+ return;
+ }
+ }
+
path = cmSystemTools::CollapseFullPath(path);
cmSystemTools::ConvertToUnixSlashes(path);
this->SetHomeDirectory(path);
- } else if (arg.find("-S", 0) == 0) {
- // There is no local generate anymore. Ignore -S option.
} else if (arg.find("-O", 0) == 0) {
// There is no local generate anymore. Ignore -O option.
} else if (arg.find("-B", 0) == 0) {
directoriesSet = true;
std::string path = arg.substr(2);
+ if (path.empty()) {
+ ++i;
+ if (i >= args.size()) {
+ cmSystemTools::Error("No build directory specified for -B");
+ return;
+ }
+ path = args[i];
+ if (path[0] == '-') {
+ cmSystemTools::Error("No build directory specified for -B");
+ return;
+ }
+ }
+
path = cmSystemTools::CollapseFullPath(path);
cmSystemTools::ConvertToUnixSlashes(path);
this->SetHomeOutputDirectory(path);
@@ -835,20 +859,27 @@ void cmake::SetDirectoriesFromFile(const char* arg)
this->SetHomeOutputDirectory(listPath);
} else {
// Source directory given on command line. Use current working
- // directory as build tree.
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- this->SetHomeOutputDirectory(cwd);
+ // directory as build tree if -B hasn't been given already
+ if (this->GetHomeOutputDirectory().empty()) {
+ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ this->SetHomeOutputDirectory(cwd);
+ }
}
return;
}
- // We didn't find a CMakeLists.txt or CMakeCache.txt file from the
- // argument. Assume it is the path to the source tree, and use the
- // current working directory as the build tree.
- std::string full = cmSystemTools::CollapseFullPath(arg);
- std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- this->SetHomeDirectory(full);
- this->SetHomeOutputDirectory(cwd);
+ if (this->GetHomeDirectory().empty()) {
+ // We didn't find a CMakeLists.txt and it wasn't specified
+ // with -S. Assume it is the path to the source tree
+ std::string full = cmSystemTools::CollapseFullPath(arg);
+ this->SetHomeDirectory(full);
+ }
+ if (this->GetHomeOutputDirectory().empty()) {
+ // We didn't find a CMakeCache.txt and it wasn't specified
+ // with -B. Assume the current working directory as the build tree.
+ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ this->SetHomeOutputDirectory(cwd);
+ }
}
// at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the
diff --git a/Source/cmake.h b/Source/cmake.h
index 4b4c67c..f7dc3f7 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -556,7 +556,9 @@ private:
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
- { "-C <initial-cache>", "Pre-load a script to populate the cache." }, \
+ { "-S <path-to-source>", "Explicitly specify a source directory." }, \
+ { "-B <path-to-build>", "Explicitly specify a build directory." }, \
+ { "-C <initial-cache>", "Pre-load a script to populate the cache." }, \
{ "-D <var>[:<type>]=<value>", "Create or update a cmake cache entry." }, \
{ "-U <globbing_expr>", "Remove matching entries from CMake cache." }, \
{ "-G <generator-name>", "Specify a build system generator." }, \
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index e3d94f6..75dabde 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -38,7 +38,8 @@ static const char* cmDocumentationName[][2] = {
static const char* cmDocumentationUsage[][2] = {
{ nullptr,
" cmake [options] <path-to-source>\n"
- " cmake [options] <path-to-existing-build>" },
+ " cmake [options] <path-to-existing-build>\n"
+ " cmake [options] -S <path-to-source> -B <path-to-build>" },
{ nullptr,
"Specify a source directory to (re-)generate a build system for "
"it in the current working directory. Specify an existing build "
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
-----------------------------------------------------------------------
Summary of changes:
Help/manual/OPTIONS_BUILD.txt | 8 +++
Help/manual/cmake.1.rst | 6 +-
Help/release/dev/cmake-explicit-dirs.rst | 10 +++
Help/release/dev/create_symlink-windows.rst | 5 ++
Source/CTest/cmCTestSubmitHandler.cxx | 23 +++++++
Source/QtDialog/CMakeSetup.cxx | 2 +-
Source/cmGlobalGenerator.cxx | 4 +-
Source/cmGlobalNinjaGenerator.cxx | 2 +-
Source/cmGlobalVisualStudio8Generator.cxx | 6 +-
Source/cmLocalUnixMakefileGenerator3.cxx | 4 +-
Source/cmLocalVisualStudio7Generator.cxx | 2 +-
Source/cmSystemTools.cxx | 25 ++++++-
Source/cmSystemTools.h | 5 ++
Source/cmake.cxx | 57 ++++++++++++----
Source/cmake.h | 4 +-
Source/cmakemain.cxx | 3 +-
Source/cmcmd.cxx | 7 +-
.../B-no-arg-result.txt} | 0
Tests/RunCMake/CommandLine/B-no-arg-stderr.txt | 1 +
.../B-no-arg2-result.txt} | 0
Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt | 1 +
.../E_create_symlink-broken-create-check.cmake | 14 ++--
.../E_create_symlink-broken-replace-check.cmake | 8 ++-
.../{BuildDir => ExplicitDirs}/CMakeLists.txt | 1 +
Tests/RunCMake/CommandLine/NoArgs-stdout.txt | 1 +
Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 76 +++++++++++++++-------
.../S-no-arg-result.txt} | 0
Tests/RunCMake/CommandLine/S-no-arg-stderr.txt | 1 +
.../S-no-arg2-result.txt} | 0
Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt | 1 +
...UE-result.txt => CDashSubmitVerbose-result.txt} | 0
...rs-stderr.txt => CDashSubmitVerbose-stderr.txt} | 0
.../ctest_submit/CDashSubmitVerbose-stdout.txt | 1 +
Tests/RunCMake/ctest_submit/RunCMakeTest.cmake | 1 +
Tests/RunCMake/ctest_submit/test.cmake.in | 1 +
35 files changed, 211 insertions(+), 69 deletions(-)
create mode 100644 Help/release/dev/cmake-explicit-dirs.rst
create mode 100644 Help/release/dev/create_symlink-windows.rst
copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/B-no-arg-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/B-no-arg-stderr.txt
copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/B-no-arg2-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt
copy Tests/RunCMake/CommandLine/{BuildDir => ExplicitDirs}/CMakeLists.txt (84%)
copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/S-no-arg-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/S-no-arg-stderr.txt
copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/S-no-arg2-result.txt} (100%)
create mode 100644 Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt
copy Tests/RunCMake/ctest_submit/{RepeatRETURN_VALUE-result.txt => CDashSubmitVerbose-result.txt} (100%)
copy Tests/RunCMake/ctest_submit/{CDashSubmitHeaders-stderr.txt => CDashSubmitVerbose-stderr.txt} (100%)
create mode 100644 Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list