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 8e495333c0914a0684d6d82e2cc15327c9f811f3 (commit) via ad0853b3d41bc8e0eae4f0baafab457ad52a9a7b (commit) from f677a3d7defdb82d79bca2faf09da6d9338773b3 (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=8e495333c0914a0684d6d82e2cc15327c9f811f3 commit 8e495333c0914a0684d6d82e2cc15327c9f811f3 Merge: f677a3d ad0853b Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jan 28 13:36:51 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Jan 28 08:36:58 2019 -0500 Merge topic 'cmake-gui-s-b' ad0853b3d4 QtDialog: Clean up and document -S and -B options Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Robert Maynard <robert.mayn...@kitware.com> Merge-request: !2863 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad0853b3d41bc8e0eae4f0baafab457ad52a9a7b commit ad0853b3d41bc8e0eae4f0baafab457ad52a9a7b Author: Kyle Edwards <kyle.edwa...@kitware.com> AuthorDate: Fri Jan 25 10:53:18 2019 -0500 Commit: Kyle Edwards <kyle.edwa...@kitware.com> CommitDate: Fri Jan 25 16:23:56 2019 -0500 QtDialog: Clean up and document -S and -B options diff --git a/Help/manual/cmake-gui.1.rst b/Help/manual/cmake-gui.1.rst index 9322e33..856aa2f 100644 --- a/Help/manual/cmake-gui.1.rst +++ b/Help/manual/cmake-gui.1.rst @@ -10,6 +10,7 @@ Synopsis cmake-gui [<options>] cmake-gui [<options>] {<path-to-source> | <path-to-existing-build>} + cmake-gui [<options>] -S <path-to-source> -B <path-to-build> Description =========== @@ -27,6 +28,14 @@ native tool on their platform. Options ======= +``-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. + .. include:: OPTIONS_HELP.txt See Also diff --git a/Help/release/dev/cmake-gui-s-b.rst b/Help/release/dev/cmake-gui-s-b.rst new file mode 100644 index 0000000..9447eb3 --- /dev/null +++ b/Help/release/dev/cmake-gui-s-b.rst @@ -0,0 +1,5 @@ +cmake-gui-s-b +------------- + +* The :manual:`cmake-gui(1)` dialog gained new ``-S`` and ``-B`` arguments to + explicitly specify source and build directories. diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 9f4e48e..cd30ad5 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -30,7 +30,8 @@ static const char* cmDocumentationUsage[][2] = { { nullptr, " cmake-gui [options]\n" " cmake-gui [options] <path-to-source>\n" - " cmake-gui [options] <path-to-existing-build>" }, + " cmake-gui [options] <path-to-existing-build>\n" + " cmake-gui [options] -S <path-to-source> -B <path-to-build>\n" }, { nullptr, nullptr } }; @@ -142,23 +143,53 @@ int main(int argc, char** argv) CMakeSetupDialog dialog; dialog.show(); - cmsys::CommandLineArguments arg; - arg.Initialize(argc2, argv2); + QStringList args = QApplication::arguments(); std::string binaryDirectory; std::string sourceDirectory; - typedef cmsys::CommandLineArguments argT; - arg.AddArgument("-B", argT::CONCAT_ARGUMENT, &binaryDirectory, - "Binary Directory"); - arg.AddArgument("-S", argT::CONCAT_ARGUMENT, &sourceDirectory, - "Source Directory"); - // do not complain about unknown options - arg.StoreUnusedArguments(true); - arg.Parse(); + for (int i = 1; i < args.size(); ++i) { + const QString& arg = args[i]; + if (arg.startsWith("-S")) { + QString path = arg.mid(2); + if (path.isEmpty()) { + ++i; + if (i >= args.size()) { + std::cerr << "No source directory specified for -S" << std::endl; + return 1; + } + path = args[i]; + if (path[0] == '-') { + std::cerr << "No source directory specified for -S" << std::endl; + return 1; + } + } + + sourceDirectory = + cmSystemTools::CollapseFullPath(path.toLocal8Bit().data()); + cmSystemTools::ConvertToUnixSlashes(sourceDirectory); + } else if (arg.startsWith("-B")) { + QString path = arg.mid(2); + if (path.isEmpty()) { + ++i; + if (i >= args.size()) { + std::cerr << "No build directory specified for -B" << std::endl; + return 1; + } + path = args[i]; + if (path[0] == '-') { + std::cerr << "No build directory specified for -B" << std::endl; + return 1; + } + } + + binaryDirectory = + cmSystemTools::CollapseFullPath(path.toLocal8Bit().data()); + cmSystemTools::ConvertToUnixSlashes(binaryDirectory); + } + } if (!sourceDirectory.empty() && !binaryDirectory.empty()) { dialog.setSourceDirectory(QString::fromLocal8Bit(sourceDirectory.c_str())); dialog.setBinaryDirectory(QString::fromLocal8Bit(binaryDirectory.c_str())); } else { - QStringList args = QApplication::arguments(); if (args.count() == 2) { std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data()); ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-gui.1.rst | 9 +++++++ Help/release/dev/cmake-gui-s-b.rst | 5 ++++ Source/QtDialog/CMakeSetup.cxx | 55 +++++++++++++++++++++++++++++--------- 3 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 Help/release/dev/cmake-gui-s-b.rst hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits