cmExportBuildFileGenerator.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmExportBuildFileGenerator_h
  11. #define cmExportBuildFileGenerator_h
  12. #include "cmExportFileGenerator.h"
  13. #include "cmListFileCache.h"
  14. /** \class cmExportBuildFileGenerator
  15. * \brief Generate a file exporting targets from a build tree.
  16. *
  17. * cmExportBuildFileGenerator generates a file exporting targets from
  18. * a build tree. A single file exports information for all
  19. * configurations built.
  20. *
  21. * This is used to implement the EXPORT() command.
  22. */
  23. class cmExportBuildFileGenerator: public cmExportFileGenerator
  24. {
  25. public:
  26. cmExportBuildFileGenerator();
  27. /** Set the list of targets to export. */
  28. void SetTargets(std::vector<std::string> const& targets)
  29. { this->Targets = targets; }
  30. std::vector<std::string> const& GetTargets() const
  31. { return this->Targets; }
  32. void AppendTargets(std::vector<std::string> const& targets)
  33. { this->Targets.insert(this->Targets.end(),
  34. targets.begin(), targets.end()); }
  35. /** Set whether to append generated code to the output file. */
  36. void SetAppendMode(bool append) { this->AppendMode = append; }
  37. void SetMakefile(cmMakefile *mf) {
  38. this->Makefile = mf;
  39. this->Makefile->GetBacktrace(this->Backtrace);
  40. }
  41. protected:
  42. // Implement virtual methods from the superclass.
  43. virtual bool GenerateMainFile(std::ostream& os);
  44. virtual void GenerateImportTargetsConfig(std::ostream& os,
  45. const char* config,
  46. std::string const& suffix,
  47. std::vector<std::string> &missingTargets);
  48. virtual void HandleMissingTarget(std::string& link_libs,
  49. std::vector<std::string>& missingTargets,
  50. cmMakefile* mf,
  51. cmTarget* depender,
  52. cmTarget* dependee);
  53. void ComplainAboutMissingTarget(cmTarget* depender,
  54. cmTarget* dependee,
  55. int occurrences);
  56. /** Fill in properties indicating built file locations. */
  57. void SetImportLocationProperty(const char* config,
  58. std::string const& suffix,
  59. cmTarget* target,
  60. ImportPropertyMap& properties);
  61. std::string InstallNameDir(cmTarget* target, const std::string& config);
  62. std::vector<std::string>
  63. FindNamespaces(cmMakefile* mf, const std::string& name);
  64. std::vector<std::string> Targets;
  65. std::vector<cmTarget*> Exports;
  66. cmMakefile* Makefile;
  67. cmListFileBacktrace Backtrace;
  68. };
  69. #endif