Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmGlobalKdevelopGenerator.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2004-2009 Kitware, Inc.
4   Copyright 2004 Alexander Neundorf (neundorf@kde.org)
5
6   Distributed under the OSI-approved BSD License (the "License");
7   see accompanying file Copyright.txt for details.
8
9   This software is distributed WITHOUT ANY WARRANTY; without even the
10   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11   See the License for more information.
12 ============================================================================*/
13 #ifndef cmGlobalKdevelopGenerator_h
14 #define cmGlobalKdevelopGenerator_h
15
16 #include "cmExternalMakefileProjectGenerator.h"
17
18 class cmLocalGenerator;
19
20 /** \class cmGlobalKdevelopGenerator
21  * \brief Write Unix Makefiles accompanied by KDevelop3 project files.
22  *
23  * cmGlobalKdevelopGenerator produces a project file for KDevelop 3 (KDevelop
24  * > 3.1.1).  The project is based on the "Custom Makefile based C/C++"
25  * project of KDevelop.  Such a project consists of Unix Makefiles in the
26  * build directory together with a \<your_project\>.kdevelop project file,
27  * which contains the project settings and a \<your_project\>.kdevelop.filelist
28  * file, which lists the source files relative to the kdevelop project
29  * directory. The kdevelop project directory is the base source directory.
30  */
31 class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator
32 {
33 public:
34   cmGlobalKdevelopGenerator();
35
36   virtual const char* GetName() const
37                           { return cmGlobalKdevelopGenerator::GetActualName();}
38   static const char* GetActualName()                     { return "KDevelop3";}
39   static cmExternalMakefileProjectGenerator* New()
40                                       { return new cmGlobalKdevelopGenerator; }
41   /** Get the documentation entry for this generator.  */
42   virtual void GetDocumentation(cmDocumentationEntry& entry,
43                                 const char* fullName) const;
44
45   virtual void Generate();
46 private:
47   /*** Create the foo.kdevelop.filelist file, return false if it doesn't
48     succeed.  If the file already exists the contents will be merged.
49     */
50   bool CreateFilelistFile(const std::vector<cmLocalGenerator*>& lgs,
51                           const std::string& outputDir,
52                           const std::string& projectDirIn,
53                           const std::string& projectname,
54                           std::string& cmakeFilePattern,
55                           std::string& fileToOpen);
56
57   /** Create the foo.kdevelop file. This one calls MergeProjectFiles()
58     if it already exists, otherwise createNewProjectFile() The project
59     files will be created in \a outputDir (in the build tree), the
60     kdevelop project dir will be set to \a projectDir (in the source
61     tree). \a cmakeFilePattern consists of a lists of all cmake
62     listfiles used by this CMakeLists.txt */
63   void CreateProjectFile(const std::string& outputDir,
64                          const std::string& projectDir,
65                          const std::string& projectname,
66                          const std::string& executable,
67                          const std::string& cmakeFilePattern,
68                          const std::string& fileToOpen);
69
70   /*** Reads the old foo.kdevelop line by line and only replaces the
71        "important" lines
72        */
73   void MergeProjectFiles(const std::string& outputDir,
74                          const std::string& projectDir,
75                          const std::string& filename,
76                          const std::string& executable,
77                          const std::string& cmakeFilePattern,
78                          const std::string& fileToOpen,
79                          const std::string& sessionFilename);
80   ///! Creates a new foo.kdevelop and a new foo.kdevses file
81   void CreateNewProjectFile(const std::string& outputDir,
82                             const std::string& projectDir,
83                             const std::string& filename,
84                             const std::string& executable,
85                             const std::string& cmakeFilePattern,
86                             const std::string& fileToOpen,
87                             const std::string& sessionFilename);
88
89   std::vector<std::string> Blacklist;
90 };
91
92 #endif