summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/CMakeSetup.cxx
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2007-11-13 05:33:22 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2007-11-13 05:33:22 (GMT)
commit47c53e867fbfaedf5c7d899d4a4900cceb3305e5 (patch)
tree2981ba46a4389148cb9867ae13c6a5c01f971647 /Source/QtDialog/CMakeSetup.cxx
parent073b10950802755d0c53748f693deab64ab152f4 (diff)
downloadCMake-47c53e867fbfaedf5c7d899d4a4900cceb3305e5.zip
CMake-47c53e867fbfaedf5c7d899d4a4900cceb3305e5.tar.gz
CMake-47c53e867fbfaedf5c7d899d4a4900cceb3305e5.tar.bz2
ENH: support specifying build or source directory at command line.
Diffstat (limited to 'Source/QtDialog/CMakeSetup.cxx')
-rw-r--r--Source/QtDialog/CMakeSetup.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 42bff4d..1f6b340 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -16,6 +16,8 @@
=========================================================================*/
#include "QCMake.h" // include to disable MS warnings
#include <QApplication>
+#include <QFileInfo>
+#include <QDir>
#include "CMakeSetupDialog.h"
@@ -26,11 +28,26 @@ int main(int argc, char** argv)
app.setOrganizationName("Kitware");
app.setWindowIcon(QIcon(":/Icons/CMakeSetup.png"));
- // TODO handle CMake args
-
CMakeSetupDialog dialog;
dialog.setWindowTitle("CMakeSetup");
dialog.show();
+
+ // for now: args support specifying build and/or source directory
+ QStringList args = app.arguments();
+ if(args.count() == 2)
+ {
+ 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());
+ }
+ }
return app.exec();
}