cmLocalKdevelopGenerator.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. Copyright (c) 2004 Alexander Neundorf, [email protected]. All rights reserved.
  9. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  10. This software is distributed WITHOUT ANY WARRANTY; without even
  11. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE. See the above copyright notices for more information.
  13. =========================================================================*/
  14. #ifndef cmLocalKdevelopGenerator_h
  15. #define cmLocalKdevelopGenerator_h
  16. #include "cmLocalUnixMakefileGenerator.h"
  17. class cmDependInformation;
  18. class cmMakeDepend;
  19. class cmTarget;
  20. class cmSourceFile;
  21. /** \class cmLocalKdevelopGenerator
  22. * \brief Write Unix Makefiles accompanied by KDevelop3 project files.
  23. *
  24. * cmLocalKdevelopGenerator produces a project file for KDevelop 3 (KDevelop > 3.1.1).
  25. * The project is based on the "Custom Makefile based C/C++" project of KDevelop.
  26. * Such a project consists of Unix Makefiles in the build directory together
  27. * with a <your_project>.kdevelop project file, which contains the project settings
  28. * and a <your_project>.kdevelop.filelist file, which lists the source files relative
  29. * to the kdevelop project directory. The kdevelop project directory is the base
  30. * source directory.
  31. */
  32. class cmLocalKdevelopGenerator : public cmLocalUnixMakefileGenerator
  33. {
  34. public:
  35. ///! Set cache only and recurse to false by default.
  36. cmLocalKdevelopGenerator();
  37. virtual ~cmLocalKdevelopGenerator();
  38. /**
  39. * Generate the makefile for this directory. fromTheTop indicates if this
  40. * is being invoked as part of a global Generate or specific to this
  41. * directory. The difference is that when done from the Top we might skip
  42. * some steps to save time, such as dependency generation for the
  43. * makefiles. This is done by a direct invocation from make.
  44. */
  45. virtual void Generate(bool fromTheTop);
  46. protected:
  47. /**
  48. Create the foo.kdevelop file. This one calls MergeProjectFiles()
  49. if it already exists, otherwise createNewProjectFile()
  50. The project files will be created in \a outputDir (in the build tree), the kdevelop project
  51. dir will be set to \a projectDir (in the source tree). \a cmakeFilePattern consists of a lists
  52. of all cmake listfiles used by this CMakeLists.txt
  53. */
  54. void CreateProjectFile(const std::string& outputDir, const std::string& projectDir,
  55. const std::string& projectname, const std::string& executable,
  56. const std::string& cmakeFilePattern);
  57. /** Create the foo.kdevelop.filelist file, return false if it doesn't succeed.
  58. If the file already exists the contents will be merged.
  59. */
  60. bool CreateFilelistFile(const std::string& outputDir, const std::string& projectDir,
  61. const std::string& projectname, std::string& cmakeFilePattern);
  62. ///! Reads the old foo.kdevelop line by line and only replaces the "important" lines
  63. void MergeProjectFiles(const std::string& outputDir, const std::string& projectDir,
  64. const std::string& filename, const std::string& executable,
  65. const std::string& cmakeFilePattern);
  66. ///! Creates a new foo.kdevelop file
  67. void CreateNewProjectFile(const std::string& outputDir, const std::string& projectDir,
  68. const std::string& filename, const std::string& executable,
  69. const std::string& cmakeFilePattern);
  70. };
  71. #endif