File indexing completed on 2024-04-28 04:38:20

0001 /*
0002     SPDX-FileCopyrightText: 2006-2007 Andreas Pakulat <apaku@gmx.de>
0003     SPDX-FileCopyrightText: 2008 Hamish Rodda <rodda@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef CMAKEJOB_H
0009 #define CMAKEJOB_H
0010 
0011 #include <outputview/outputexecutejob.h>
0012 
0013 #include <util/path.h>
0014 
0015 namespace KDevelop {
0016 class IProject;
0017 class ProjectBaseItem;
0018 }
0019 
0020 class CMakeJob: public KDevelop::OutputExecuteJob
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     enum ErrorTypes
0026     {
0027         NoProjectError = UserDefinedError,
0028         FailedError
0029     };
0030 
0031     explicit CMakeJob(QObject* parent = nullptr);
0032     
0033     void setProject(KDevelop::IProject* project);
0034 
0035     void start() override;
0036 
0037     // This returns the build directory for registered item.
0038     QUrl workingDirectory() const override;
0039 
0040     // This returns the "cmake" command line.
0041     QStringList commandLine() const override;
0042 
0043     // This returns the configured global environment profile.
0044     QString environmentProfile() const override;
0045 
0046 private:
0047     QStringList cmakeArguments( KDevelop::IProject* project );
0048     KDevelop::Path buildDir( KDevelop::IProject* project );
0049 
0050     KDevelop::IProject* m_project = nullptr;
0051 };
0052 
0053 #endif // CMAKEJOB_H