cmSourceGroup.cxx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "cmSourceGroup.h"
  14. /**
  15. * The constructor initializes the group's regular expression.
  16. */
  17. cmSourceGroup::cmSourceGroup(const char* name, const char* regex):
  18. m_Name(name),
  19. m_GroupRegex(regex)
  20. {
  21. }
  22. /**
  23. * Copy constructor.
  24. */
  25. cmSourceGroup::cmSourceGroup(const cmSourceGroup& r):
  26. m_Name(r.m_Name),
  27. m_GroupRegex(r.m_GroupRegex),
  28. m_SourceFiles(r.m_SourceFiles)
  29. {
  30. }
  31. /**
  32. * Returns whether the given name matches the group's regular expression.
  33. */
  34. bool cmSourceGroup::Matches(const char* name)
  35. {
  36. return m_GroupRegex.find(name);
  37. }
  38. /**
  39. * Add a source to the group that the compiler will know how to build.
  40. */
  41. void cmSourceGroup::AddSource(const char* name, const cmSourceFile* sf)
  42. {
  43. m_SourceFiles.push_back(sf);
  44. }