cmExportBuildFileGenerator.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 cmExportSet;
  15. /** \class cmExportBuildFileGenerator
  16. * \brief Generate a file exporting targets from a build tree.
  17. *
  18. * cmExportBuildFileGenerator generates a file exporting targets from
  19. * a build tree. A single file exports information for all
  20. * configurations built.
  21. *
  22. * This is used to implement the EXPORT() command.
  23. */
  24. class cmExportBuildFileGenerator: public cmExportFileGenerator
  25. {
  26. public:
  27. cmExportBuildFileGenerator();
  28. /** Set the list of targets to export. */
  29. void SetTargets(std::vector<std::string> const& targets)
  30. { this->Targets = targets; }
  31. void GetTargets(std::vector<std::string> &targets) const;
  32. void AppendTargets(std::vector<std::string> const& targets)
  33. { this->Targets.insert(this->Targets.end(),
  34. targets.begin(), targets.end()); }
  35. void SetExportSet(cmExportSet*);
  36. /** Set whether to append generated code to the output file. */
  37. void SetAppendMode(bool append) { this->AppendMode = append; }
  38. void Compute(cmLocalGenerator* lg);
  39. protected:
  40. // Implement virtual methods from the superclass.
  41. virtual bool GenerateMainFile(std::ostream& os);
  42. virtual void GenerateImportTargetsConfig(std::ostream& os,
  43. const std::string& config,
  44. std::string const& suffix,
  45. std::vector<std::string> &missingTargets);
  46. virtual void HandleMissingTarget(std::string& link_libs,
  47. std::vector<std::string>& missingTargets,
  48. cmGeneratorTarget* depender,
  49. cmGeneratorTarget* dependee);
  50. void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
  51. cmGeneratorTarget* dependee,
  52. int occurrences);
  53. /** Fill in properties indicating built file locations. */
  54. void SetImportLocationProperty(const std::string& config,
  55. std::string const& suffix,
  56. cmGeneratorTarget* target,
  57. ImportPropertyMap& properties);
  58. std::string InstallNameDir(cmGeneratorTarget* target,
  59. const std::string& config);
  60. std::vector<std::string>
  61. FindNamespaces(cmGlobalGenerator* gg, const std::string& name);
  62. std::vector<std::string> Targets;
  63. cmExportSet *ExportSet;
  64. std::vector<cmGeneratorTarget*> Exports;
  65. cmLocalGenerator* LG;
  66. };
  67. #endif