diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2007-11-13 05:33:22 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2007-11-13 05:33:22 (GMT) |
commit | 47c53e867fbfaedf5c7d899d4a4900cceb3305e5 (patch) | |
tree | 2981ba46a4389148cb9867ae13c6a5c01f971647 /Source | |
parent | 073b10950802755d0c53748f693deab64ab152f4 (diff) | |
download | CMake-47c53e867fbfaedf5c7d899d4a4900cceb3305e5.zip CMake-47c53e867fbfaedf5c7d899d4a4900cceb3305e5.tar.gz CMake-47c53e867fbfaedf5c7d899d4a4900cceb3305e5.tar.bz2 |
ENH: support specifying build or source directory at command line.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 21 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 9 |
2 files changed, 23 insertions, 7 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(); } diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index fe30896..afa3157 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -113,6 +113,10 @@ CMakeSetupDialog::CMakeSetupDialog() this, SLOT(doHelp())); this->setAcceptDrops(true); + + // get the saved binary directories + QStringList buildPaths = this->loadBuildPaths(); + this->BinaryDirectory->addItems(buildPaths); // start the cmake worker thread this->CMakeThread = new QCMakeThread(this); @@ -191,11 +195,6 @@ void CMakeSetupDialog::initialize() QObject::connect(this->AddEntry, SIGNAL(clicked(bool)), this, SLOT(addCacheEntry())); - // get the saved binary directories - QStringList buildPaths = this->loadBuildPaths(); - this->BinaryDirectory->blockSignals(true); - this->BinaryDirectory->addItems(buildPaths); - this->BinaryDirectory->blockSignals(false); if(!this->SourceDirectory->text().isEmpty() || !this->BinaryDirectory->lineEdit()->text().isEmpty()) |