diff options
Diffstat (limited to 'Source/QtDialog')
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 55 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup128.png | bin | 10944 -> 7981 bytes | |||
-rw-r--r-- | Source/QtDialog/CMakeSetup32.png | bin | 2097 -> 1632 bytes | |||
-rw-r--r-- | Source/QtDialog/CMakeSetup64.png | bin | 4676 -> 3566 bytes | |||
-rw-r--r-- | Source/QtDialog/Delete16.png | bin | 731 -> 538 bytes | |||
-rw-r--r-- | Source/QtDialog/Plus16.png | bin | 358 -> 207 bytes |
6 files changed, 43 insertions, 12 deletions
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()); diff --git a/Source/QtDialog/CMakeSetup128.png b/Source/QtDialog/CMakeSetup128.png Binary files differindex 728ef02..32984e1 100644 --- a/Source/QtDialog/CMakeSetup128.png +++ b/Source/QtDialog/CMakeSetup128.png diff --git a/Source/QtDialog/CMakeSetup32.png b/Source/QtDialog/CMakeSetup32.png Binary files differindex 1c36b31..78df82f 100644 --- a/Source/QtDialog/CMakeSetup32.png +++ b/Source/QtDialog/CMakeSetup32.png diff --git a/Source/QtDialog/CMakeSetup64.png b/Source/QtDialog/CMakeSetup64.png Binary files differindex 44eb171..5c2dbf5 100644 --- a/Source/QtDialog/CMakeSetup64.png +++ b/Source/QtDialog/CMakeSetup64.png diff --git a/Source/QtDialog/Delete16.png b/Source/QtDialog/Delete16.png Binary files differindex 16989fee..9d2f2b7 100644 --- a/Source/QtDialog/Delete16.png +++ b/Source/QtDialog/Delete16.png diff --git a/Source/QtDialog/Plus16.png b/Source/QtDialog/Plus16.png Binary files differindex 552f6f0..1c33bc7 100644 --- a/Source/QtDialog/Plus16.png +++ b/Source/QtDialog/Plus16.png |