ENH: change the search path order (if several Tcl/Tk are installed, the "current...
[cmake.git] / Source / cmSourceGroup.h
blob83f39b8a423fd3113d70e5be4476d38e10a1923c
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmSourceGroup.h,v $
5 Language: C++
6 Date: $Date: 2002-03-04 19:12:51 $
7 Version: $Revision: 1.11 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmSourceGroup_h
18 #define cmSourceGroup_h
20 #include "cmStandardIncludes.h"
21 #include "cmRegularExpression.h"
22 #include "cmCustomCommand.h"
23 class cmSourceFile;
25 /** \class cmSourceGroup
26 * \brief Hold a group of sources as specified by a SOURCE_GROUP command.
28 * cmSourceGroup holds all the source files and corresponding commands
29 * for files matching the regular expression specified for the group.
31 class cmSourceGroup
33 public:
34 cmSourceGroup(const char* name, const char* regex);
35 cmSourceGroup(const cmSourceGroup&);
36 ~cmSourceGroup() {}
38 struct CommandFiles
40 CommandFiles() {}
41 CommandFiles(const CommandFiles& r):
42 m_Outputs(r.m_Outputs), m_Depends(r.m_Depends) {}
44 void Merge(const CommandFiles &r);
46 std::string m_Command;
47 std::string m_Arguments;
48 std::set<std::string> m_Outputs;
49 std::set<std::string> m_Depends;
52 /**
53 * Map from command to its output/depends sets.
55 typedef std::map<cmStdString, CommandFiles> Commands;
57 struct SourceAndCommands
59 SourceAndCommands(): m_SourceFile(0) {}
60 const cmSourceFile* m_SourceFile;
61 Commands m_Commands;
63 /**
64 * Map from source to command map.
66 typedef std::map<cmStdString, SourceAndCommands> BuildRules;
68 bool Matches(const char* name);
69 void SetGroupRegex(const char* regex)
70 { m_GroupRegex.compile(regex); }
71 void AddSource(const char* name, const cmSourceFile*);
72 void AddCustomCommand(const cmCustomCommand &cmd);
73 const char* GetName() const
74 { return m_Name.c_str(); }
75 const BuildRules& GetBuildRules() const
76 { return m_BuildRules; }
77 void Print() const;
78 private:
79 /**
80 * The name of the source group.
82 std::string m_Name;
84 /**
85 * The regular expression matching the files in the group.
87 cmRegularExpression m_GroupRegex;
89 /**
90 * Map from source name to the commands to build from the source.
91 * Some commands may build from files that the compiler also knows how to
92 * build.
94 BuildRules m_BuildRules;
97 #endif