aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
diff options
context:
space:
mode:
authordt <[email protected]>2009-03-09 18:13:19 +0100
committerdt <[email protected]>2009-03-09 18:13:19 +0100
commitef1693e9a3142f4ced3db9885cf5873192a3f9d0 (patch)
treeb8a2fc3f4c0ffa3e6688b2a3520dc42010ca441a /src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
parentb99f3b61b4388391eb04c21da6558c5a15c1e532 (diff)
Fixes: Add a smarter cmake open project wizard.
Details: That fixes a few bugs, while still having a few missing things. Don't allow the user to set a shadow build directory, if there is already a in source build. Detect if a cbp file is already existing and recent enough, don't rerun cmake then. Ensure that the user runs cmake with the cbp generator on opening the project. Show the output of the cmake generator while running. Remove the unecessary cmake step.
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
index 1a8e2fd49a7..4032b142336 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
@@ -94,7 +94,7 @@ QString CMakeManager::cmakeExecutable() const
// we probably want the process instead of this function
// cmakeproject then could even run the cmake process in the background, adding the files afterwards
// sounds like a plan
-QString CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory)
+QProcess *CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory)
{
// We create a cbp file, only if we didn't find a cbp file in the base directory
// Yet that can still override cbp files in subdirectories
@@ -108,21 +108,30 @@ QString CMakeManager::createXmlFile(const QStringList &arguments, const QString
QString buildDirectoryPath = buildDirectory.absolutePath();
qDebug()<<"Creating cbp file in"<<buildDirectoryPath;
buildDirectory.mkpath(buildDirectoryPath);
- QProcess cmake;
- cmake.setWorkingDirectory(buildDirectoryPath);
+ QProcess * cmake = new QProcess;
+ cmake->setWorkingDirectory(buildDirectoryPath);
QString generator = "-GCodeBlocks - Unix Makefiles";
- cmake.start(cmakeExecutable(), QStringList() << sourceDirectory << arguments << generator);
-
- qDebug()<<cmakeExecutable()<<sourceDirectory << arguments;
- cmake.waitForFinished(-1);
- cmake.setProcessChannelMode(QProcess::MergedChannels);
- QString output = cmake.readAll();
- qDebug()<<"cmake output: \n"<<output;
- return output;
+ qDebug()<<cmakeExecutable()<<sourceDirectory << arguments<<generator;
+ cmake->start(cmakeExecutable(), QStringList() << sourceDirectory << arguments << generator);
+ return cmake;
+}
+
+QString CMakeManager::findCbpFile(const QDir &directory)
+{
+ // Find the cbp file
+ // TODO the cbp file is named like the project() command in the CMakeList.txt file
+ // so this method below could find the wrong cbp file, if the user changes the project()
+ // 2name
+ foreach (const QString &cbpFile , directory.entryList()) {
+ if (cbpFile.endsWith(".cbp"))
+ return directory.path() + "/" + cbpFile;
+ }
+ return QString::null;
}
+
/////
// CMakeRunner
////