cmSourceGroupCommand.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmSourceGroupCommand_h
  4. #define cmSourceGroupCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <map>
  7. #include <string>
  8. #include <vector>
  9. #include "cmCommand.h"
  10. class cmExecutionStatus;
  11. /** \class cmSourceGroupCommand
  12. * \brief Adds a cmSourceGroup to the cmMakefile.
  13. *
  14. * cmSourceGroupCommand is used to define cmSourceGroups which split up
  15. * source files in to named, organized groups in the generated makefiles.
  16. */
  17. class cmSourceGroupCommand : public cmCommand
  18. {
  19. public:
  20. /**
  21. * This is a virtual constructor for the command.
  22. */
  23. cmCommand* Clone() override { return new cmSourceGroupCommand; }
  24. /**
  25. * This is called when the command is first encountered in
  26. * the CMakeLists.txt file.
  27. */
  28. bool InitialPass(std::vector<std::string> const& args,
  29. cmExecutionStatus& status) override;
  30. private:
  31. typedef std::map<std::string, std::vector<std::string>> ParsedArguments;
  32. typedef std::vector<std::string> ExpectedOptions;
  33. ExpectedOptions getExpectedOptions() const;
  34. bool isExpectedOption(const std::string& argument,
  35. const ExpectedOptions& expectedOptions);
  36. void parseArguments(const std::vector<std::string>& args,
  37. cmSourceGroupCommand::ParsedArguments& parsedArguments);
  38. bool processTree(ParsedArguments& parsedArguments, std::string& errorMsg);
  39. bool checkArgumentsPreconditions(const ParsedArguments& parsedArguments,
  40. std::string& errorMsg) const;
  41. bool checkSingleParameterArgumentPreconditions(
  42. const std::string& argument, const ParsedArguments& parsedArguments,
  43. std::string& errorMsg) const;
  44. };
  45. #endif