summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/CMakeSetup.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-02-12 14:49:42 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-02-12 14:49:42 (GMT)
commit3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8 (patch)
treef32e5b7a4fda680667ac13c1c9a76e2c0836dcee /Source/QtDialog/CMakeSetup.cxx
parent88eca37d4ef804efc7d6cc204cf96ca07abd8482 (diff)
downloadCMake-3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8.zip
CMake-3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8.tar.gz
CMake-3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8.tar.bz2
ENH: fix make edit_cache for cmake-gui
Diffstat (limited to 'Source/QtDialog/CMakeSetup.cxx')
-rw-r--r--Source/QtDialog/CMakeSetup.cxx44
1 files changed, 32 insertions, 12 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 5d8f3c1..8be36f9 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -26,6 +26,7 @@
#include "cmSystemTools.h"
#include "cmake.h"
#include "cmVersion.h"
+#include <cmsys/CommandLineArguments.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][3] =
@@ -125,20 +126,39 @@ int main(int argc, char** argv)
dialog.setWindowTitle(title);
dialog.show();
- // for now: args support specifying build and/or source directory
- QStringList args = app.arguments();
- if(args.count() == 2)
+ cmsys::CommandLineArguments arg;
+ arg.Initialize(argc, argv);
+ std::string binaryDirectory;
+ std::string sourceDirectory;
+ typedef cmsys::CommandLineArguments argT;
+ arg.AddArgument("-B", argT::CONCAT_ARGUMENT,
+ &binaryDirectory, "Binary Directory");
+ arg.AddArgument("-H", argT::CONCAT_ARGUMENT,
+ &sourceDirectory, "Source Directory");
+ // do not complain about unknown options
+ arg.StoreUnusedArguments(true);
+ arg.Parse();
+ if(!sourceDirectory.empty() && !binaryDirectory.empty())
{
- QFileInfo buildFileInfo(args[1], "CMakeCache.txt");
- QFileInfo srcFileInfo(args[1], "CMakeLists.txt");
- if(buildFileInfo.exists())
- {
- dialog.setBinaryDirectory(buildFileInfo.absolutePath());
- }
- else if(srcFileInfo.exists())
+ dialog.setSourceDirectory(sourceDirectory.c_str());
+ dialog.setBinaryDirectory(binaryDirectory.c_str());
+ }
+ else
+ {
+ QStringList args = app.arguments();
+ if(args.count() == 2)
{
- dialog.setSourceDirectory(srcFileInfo.absolutePath());
- dialog.setBinaryDirectory(QDir::currentPath());
+ QFileInfo buildFileInfo(args[1], "CMakeCache.txt");
+ QFileInfo srcFileInfo(args[1], "CMakeLists.txt");
+ if(buildFileInfo.exists())
+ {
+ dialog.setBinaryDirectory(buildFileInfo.absolutePath());
+ }
+ else if(srcFileInfo.exists())
+ {
+ dialog.setSourceDirectory(srcFileInfo.absolutePath());
+ dialog.setBinaryDirectory(QDir::currentPath());
+ }
}
}