packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmLoadCacheCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmLoadCacheCommand_h
13 #define cmLoadCacheCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmLoadCacheCommand
18  * \brief load a cache file
19  *
20  * cmLoadCacheCommand loads the non internal values of a cache file
21  */
22 class cmLoadCacheCommand : public cmCommand
23 {
24 public:
25   /**
26    * This is a virtual constructor for the command.
27    */
28   virtual cmCommand* Clone()
29     {
30     return new cmLoadCacheCommand;
31     }
32
33   /**
34    * This is called when the command is first encountered in
35    * the CMakeLists.txt file.
36    */
37   virtual bool InitialPass(std::vector<std::string> const& args,
38                            cmExecutionStatus &status);
39
40   /**
41    * The name of the command as specified in CMakeList.txt.
42    */
43   virtual const char* GetName() const { return "load_cache";}
44
45   /**
46    * Succinct documentation.
47    */
48   virtual const char* GetTerseDocumentation() const
49     {
50     return "Load in the values from another project's CMake cache.";
51     }
52
53   /**
54    * More documentation.
55    */
56   virtual const char* GetFullDocumentation() const
57     {
58     return
59       "  load_cache(pathToCacheFile READ_WITH_PREFIX\n"
60       "             prefix entry1...)\n"
61       "Read the cache and store the requested entries in variables with "
62       "their name prefixed with the given prefix.  "
63       "This only reads the values, and does not create entries in the local "
64       "project's cache.\n"
65       "  load_cache(pathToCacheFile [EXCLUDE entry1...]\n"
66       "             [INCLUDE_INTERNALS entry1...])\n"
67       "Load in the values from another cache and store them in the local "
68       "project's cache as internal entries.  This is useful for a project "
69       "that depends on another project built in a different tree.  "
70       "EXCLUDE option can be used to provide a list of entries to be "
71       "excluded.  "
72       "INCLUDE_INTERNALS can be used to provide a list of internal entries "
73       "to be included.  Normally, no internal entries are brought in.  Use "
74       "of this form of the command is strongly discouraged, but it is "
75       "provided for backward compatibility.";
76     }
77
78   cmTypeMacro(cmLoadCacheCommand, cmCommand);
79 protected:
80
81   std::set<cmStdString> VariablesToRead;
82   std::string Prefix;
83
84   bool ReadWithPrefix(std::vector<std::string> const& args);
85   void CheckLine(const char* line);
86 };
87
88
89 #endif