1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmLoadCacheCommand.h,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.14 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmLoadCacheCommand_h
18 #define cmLoadCacheCommand_h
20 #include "cmCommand.h"
22 /** \class cmLoadCacheCommand
23 * \brief load a cache file
25 * cmLoadCacheCommand loads the non internal values of a cache file
27 class cmLoadCacheCommand
: public cmCommand
31 * This is a virtual constructor for the command.
33 virtual cmCommand
* Clone()
35 return new cmLoadCacheCommand
;
39 * This is called when the command is first encountered in
40 * the CMakeLists.txt file.
42 virtual bool InitialPass(std::vector
<std::string
> const& args
,
43 cmExecutionStatus
&status
);
46 * The name of the command as specified in CMakeList.txt.
48 virtual const char* GetName() { return "load_cache";}
51 * Succinct documentation.
53 virtual const char* GetTerseDocumentation()
55 return "Load in the values from another project's CMake cache.";
61 virtual const char* GetFullDocumentation()
64 " load_cache(pathToCacheFile READ_WITH_PREFIX\n"
65 " prefix entry1...)\n"
66 "Read the cache and store the requested entries in variables with "
67 "their name prefixed with the given prefix. "
68 "This only reads the values, and does not create entries in the local "
70 " load_cache(pathToCacheFile [EXCLUDE entry1...]\n"
71 " [INCLUDE_INTERNALS entry1...])\n"
72 "Load in the values from another cache and store them in the local "
73 "project's cache as internal entries. This is useful for a project "
74 "that depends on another project built in a different tree. "
75 "EXCLUDE option can be used to provide a list of entries to be "
77 "INCLUDE_INTERNALS can be used to provide a list of internal entries "
78 "to be included. Normally, no internal entries are brought in. Use "
79 "of this form of the command is strongly discouraged, but it is "
80 "provided for backward compatibility.";
83 cmTypeMacro(cmLoadCacheCommand
, cmCommand
);
86 std::set
<cmStdString
> VariablesToRead
;
89 bool ReadWithPrefix(std::vector
<std::string
> const& args
);
90 void CheckLine(const char* line
);
91 bool ParseEntry(const char* entry
, std::string
& var
, std::string
& value
);