1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetCommand.h,v $
7 Date: $Date: 2008/01/23 15:27:59 $
8 Version: $Revision: 1.20 $
10 Date: $Date: 2008-08-25 14:31:28 $
11 Version: $Revision: 1.21 $
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmSetCommand_h
23 #define cmSetCommand_h
25 #include "cmCommand.h"
27 /** \class cmSetCommand
28 * \brief Set a CMAKE variable
30 * cmSetCommand sets a variable to a value with expansion.
32 class cmSetCommand
: public cmCommand
36 * This is a virtual constructor for the command.
38 virtual cmCommand
* Clone()
40 return new cmSetCommand
;
44 * This is called when the command is first encountered in
45 * the CMakeLists.txt file.
47 virtual bool InitialPass(std::vector
<std::string
> const& args
,
48 cmExecutionStatus
&status
);
51 * This determines if the command is invoked when in script mode.
53 virtual bool IsScriptable() { return true; }
56 * The name of the command as specified in CMakeList.txt.
58 virtual const char* GetName() {return "set";}
61 * Succinct documentation.
63 virtual const char* GetTerseDocumentation()
65 return "Set a CMAKE variable to a given value.";
71 virtual const char* GetFullDocumentation()
74 " set(<variable> <value> [[CACHE <type> <docstring> [FORCE]] | "
76 "Within CMake sets <variable> to the value <value>. <value> is expanded"
77 " before <variable> is set to it. If CACHE is present, then the "
78 "<variable> is put in the cache. <type> and <docstring> are then "
79 "required. <type> is used by the CMake GUI to choose a widget with "
80 "which the user sets a value. The value for <type> may be one of\n"
81 " FILEPATH = File chooser dialog.\n"
82 " PATH = Directory chooser dialog.\n"
83 " STRING = Arbitrary string.\n"
84 " BOOL = Boolean ON/OFF checkbox.\n"
85 " INTERNAL = No GUI entry (used for persistent variables).\n"
86 "If <type> is INTERNAL, then the <value> is always written into the "
87 "cache, replacing any values existing in the cache. If it is not a "
88 "cache variable, then this always writes into the current makefile. The "
89 "FORCE option will overwrite the cache value removing any changes by "
91 "If PARENT_SCOPE is present, the variable will be set in the scope "
92 "above the current scope. Each new directory or function creates a new "
93 "scope. This command will set the value of a variable into the parent "
94 "directory or calling function (whichever is applicable to the case at "
96 "If <value> is not specified then the variable is removed "
97 "instead of set. See also: the unset() command.\n"
98 " set(<variable> <value1> ... <valueN>)\n"
99 "In this case <variable> is set to a semicolon separated list of "
101 "<variable> can be an environment variable such as:\n"
102 " set( ENV{PATH} /home/martink )\n"
103 "in which case the environment variable will be set.";
106 cmTypeMacro(cmSetCommand
, cmCommand
);