1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetPropertyCommand.h,v $
6 Date: $Date: 2009-03-10 15:10:59 $
7 Version: $Revision: 1.5 $
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 cmSetsPropertiesCommand_h
18 #define cmSetsPropertiesCommand_h
20 #include "cmCommand.h"
22 class cmSetPropertyCommand
: public cmCommand
25 cmSetPropertyCommand();
27 virtual cmCommand
* Clone()
29 return new cmSetPropertyCommand
;
33 * This is called when the command is first encountered in
36 virtual bool InitialPass(std::vector
<std::string
> const& args
,
37 cmExecutionStatus
&status
);
40 * The name of the command as specified in CMakeList.txt.
42 virtual const char* GetName() { return "set_property";}
45 * Succinct documentation.
47 virtual const char* GetTerseDocumentation()
49 return "Set a named property in a given scope.";
53 * Longer documentation.
55 virtual const char* GetFullDocumentation()
58 " set_property(<GLOBAL |\n"
59 " DIRECTORY [dir] |\n"
60 " TARGET [target1 [target2 ...]] |\n"
61 " SOURCE [src1 [src2 ...]] |\n"
62 " TEST [test1 [test2 ...]] |\n"
63 " CACHE [entry1 [entry2 ...]]>\n"
65 " PROPERTY <name> [value1 [value2 ...]])\n"
66 "Set one property on zero or more objects of a scope. "
67 "The first argument determines the scope in which the property "
68 "is set. It must be one of the following:\n"
69 "GLOBAL scope is unique and does not accept a name.\n"
70 "DIRECTORY scope defaults to the current directory but another "
71 "directory (already processed by CMake) may be named by full or "
73 "TARGET scope may name zero or more existing targets.\n"
74 "SOURCE scope may name zero or more source files.\n"
75 "TEST scope may name zero or more existing tests.\n"
76 "CACHE scope must name zero or more cache existing entries.\n"
77 "The required PROPERTY option is immediately followed by the name "
78 "of the property to set. Remaining arguments are used to "
79 "compose the property value in the form of a semicolon-separated "
81 "If the APPEND option is given the list is appended to any "
82 "existing property value."
87 * This determines if the command is invoked when in script mode.
89 virtual bool IsScriptable() { return true; }
91 cmTypeMacro(cmSetPropertyCommand
, cmCommand
);
94 std::set
<cmStdString
> Names
;
95 std::string PropertyName
;
96 std::string PropertyValue
;
100 // Implementation of each property type.
101 bool HandleGlobalMode();
102 bool HandleDirectoryMode();
103 bool HandleTargetMode();
104 bool HandleTarget(cmTarget
* target
);
105 bool HandleSourceMode();
106 bool HandleSource(cmSourceFile
* sf
);
107 bool HandleTestMode();
108 bool HandleTest(cmTest
* test
);
109 bool HandleCacheMode();
110 bool HandleCacheEntry(cmCacheManager::CacheIterator
&);