cmExportBuildFileGenerator.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. /** Fill in properties indicating built file locations. */
  56. void SetImportLocationProperty(const char* config,
  57. std::string const& suffix,
  58. cmTarget* target,
  59. ImportPropertyMap& properties);
  60. std::string InstallNameDir(cmTarget* target, const std::string& config);
  61. std::vector<std::string> Targets;
  62. std::vector<cmTarget*> Exports;
  63. cmMakefile* Makefile;
  64. cmListFileBacktrace Backtrace;
  65. };
  66. #endif