cmExportBuildFileGenerator.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 SetMakefile(cmMakefile *mf) {
  39. this->Makefile = mf;
  40. this->Backtrace = this->Makefile->GetBacktrace();
  41. }
  42. protected:
  43. // Implement virtual methods from the superclass.
  44. virtual bool GenerateMainFile(std::ostream& os);
  45. virtual void GenerateImportTargetsConfig(std::ostream& os,
  46. const std::string& config,
  47. std::string const& suffix,
  48. std::vector<std::string> &missingTargets);
  49. virtual void HandleMissingTarget(std::string& link_libs,
  50. std::vector<std::string>& missingTargets,
  51. cmMakefile* mf,
  52. cmTarget* depender,
  53. cmTarget* dependee);
  54. void ComplainAboutMissingTarget(cmTarget* depender,
  55. cmTarget* dependee,
  56. int occurrences);
  57. /** Fill in properties indicating built file locations. */
  58. void SetImportLocationProperty(const std::string& config,
  59. std::string const& suffix,
  60. cmGeneratorTarget* target,
  61. ImportPropertyMap& properties);
  62. std::string InstallNameDir(cmTarget* target, const std::string& config);
  63. std::vector<std::string>
  64. FindNamespaces(cmMakefile* mf, const std::string& name);
  65. std::vector<std::string> Targets;
  66. cmExportSet *ExportSet;
  67. std::vector<cmGeneratorTarget*> Exports;
  68. cmMakefile* Makefile;
  69. cmListFileBacktrace Backtrace;
  70. };
  71. #endif