cmSourceGroup.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmSourceGroup_h
  14. #define cmSourceGroup_h
  15. #include "cmStandardIncludes.h"
  16. #include <cmsys/RegularExpression.hxx>
  17. class cmSourceFile;
  18. /** \class cmSourceGroup
  19. * \brief Hold a group of sources as specified by a SOURCE_GROUP command.
  20. *
  21. * cmSourceGroup holds all the source files and corresponding commands
  22. * for files matching the regular expression specified for the group.
  23. */
  24. class cmSourceGroup
  25. {
  26. public:
  27. cmSourceGroup(const char* name, const char* regex);
  28. cmSourceGroup(const cmSourceGroup&);
  29. ~cmSourceGroup() {}
  30. void SetGroupRegex(const char* regex)
  31. { m_GroupRegex.compile(regex); }
  32. void AddSource(const char* name, const cmSourceFile*);
  33. const char* GetName() const
  34. { return m_Name.c_str(); }
  35. bool Matches(const char *);
  36. /**
  37. * Get the list of the source files used by this target
  38. */
  39. const std::vector<const cmSourceFile*> &GetSourceFiles() const
  40. {return m_SourceFiles;}
  41. std::vector<const cmSourceFile*> &GetSourceFiles() {return m_SourceFiles;}
  42. private:
  43. /**
  44. * The name of the source group.
  45. */
  46. std::string m_Name;
  47. /**
  48. * The regular expression matching the files in the group.
  49. */
  50. cmsys::RegularExpression m_GroupRegex;
  51. /**
  52. * vector of all source files in this source group
  53. */
  54. std::vector<const cmSourceFile*> m_SourceFiles;
  55. };
  56. #endif