cmTarget.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmTarget_h
  14. #define cmTarget_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCustomCommand.h"
  17. #include "cmSourceFile.h"
  18. /** \class cmTarget
  19. * \brief Represent a library or executable target loaded from a makefile.
  20. *
  21. * cmTarget represents a target loaded from
  22. * a makefile.
  23. */
  24. class cmTarget
  25. {
  26. public:
  27. enum TargetType { EXECUTABLE, WIN32_EXECUTABLE, STATIC_LIBRARY,
  28. SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, INSTALL_FILES,
  29. INSTALL_PROGRAMS };
  30. /**
  31. * Return the type of target.
  32. */
  33. TargetType GetType() const
  34. {
  35. return m_TargetType;
  36. }
  37. void SetType(TargetType f) { m_TargetType = f; }
  38. /**
  39. * Indicate whether the target is part of the all target
  40. */
  41. bool IsInAll() const { return m_InAll; }
  42. bool GetInAll() const { return m_InAll; }
  43. void SetInAll(bool f) { m_InAll = f; }
  44. /**
  45. * Get the list of the custom commands for this target
  46. */
  47. const std::vector<cmCustomCommand> &GetCustomCommands() const {return m_CustomCommands;}
  48. std::vector<cmCustomCommand> &GetCustomCommands() {return m_CustomCommands;}
  49. /**
  50. * Get the list of the source lists used by this target
  51. */
  52. const std::vector<std::string> &GetSourceLists() const
  53. {return m_SourceLists;}
  54. std::vector<std::string> &GetSourceLists() {return m_SourceLists;}
  55. /**
  56. * Get the list of the source files used by this target
  57. */
  58. const std::vector<cmSourceFile> &GetSourceFiles() const
  59. {return m_SourceFiles;}
  60. std::vector<cmSourceFile> &GetSourceFiles() {return m_SourceFiles;}
  61. /**
  62. * Get the list of the source files used by this target
  63. */
  64. enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
  65. typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries;
  66. const LinkLibraries &GetLinkLibraries() const {return m_LinkLibraries;}
  67. LinkLibraries &GetLinkLibraries() {return m_LinkLibraries;}
  68. /**
  69. * Set the path where this target should be installed. This is relative to
  70. * INSTALL_PREFIX
  71. */
  72. std::string GetInstallPath() const {return m_InstallPath;}
  73. void SetInstallPath(const char *name) {m_InstallPath = name;}
  74. /**
  75. * Merge Link Libraries into this targets current list
  76. */
  77. void MergeLibraries(const LinkLibraries &ll);
  78. /**
  79. * Generate the SourceFilesList from the SourceLists. This should only be
  80. * done once to be safe.
  81. */
  82. void GenerateSourceFilesFromSourceLists(const cmMakefile &mf);
  83. /** Add a utility on which this project depends. A utility is an executable
  84. * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
  85. * commands. It is not a full path nor does it have an extension.
  86. */
  87. void AddUtility(const char* u) { m_Utilities.insert(u);}
  88. ///! Get the utilities used by this target
  89. std::set<std::string>const& GetUtilities() const { return m_Utilities; }
  90. private:
  91. std::vector<cmCustomCommand> m_CustomCommands;
  92. std::vector<std::string> m_SourceLists;
  93. TargetType m_TargetType;
  94. std::vector<cmSourceFile> m_SourceFiles;
  95. LinkLibraries m_LinkLibraries;
  96. bool m_InAll;
  97. std::string m_InstallPath;
  98. std::set<std::string> m_Utilities;
  99. };
  100. typedef std::map<cmStdString,cmTarget> cmTargets;
  101. #endif