cmExportBuildFileGenerator.h 3.2 KB

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