summaryrefslogtreecommitdiffstats
path: root/Source/cmSetPropertyCommand.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-17 20:54:49 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-17 20:54:49 (GMT)
commitb8357db11d96eeb995b8443404e46466a493ab15 (patch)
tree9ccde29b2977a773527fed66ecb595e0b8282fbc /Source/cmSetPropertyCommand.h
parent456631225b11163f52b82989c1824bcd9ca3471c (diff)
downloadCMake-b8357db11d96eeb995b8443404e46466a493ab15.zip
CMake-b8357db11d96eeb995b8443404e46466a493ab15.tar.gz
CMake-b8357db11d96eeb995b8443404e46466a493ab15.tar.bz2
ENH: Rename SET_PROPERITES command to SET_PROPERTY and give it a more powerful signature.
Diffstat (limited to 'Source/cmSetPropertyCommand.h')
-rw-r--r--Source/cmSetPropertyCommand.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
new file mode 100644
index 0000000..c5de8e5
--- /dev/null
+++ b/Source/cmSetPropertyCommand.h
@@ -0,0 +1,112 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmSetsPropertiesCommand_h
+#define cmSetsPropertiesCommand_h
+
+#include "cmCommand.h"
+
+class cmSetPropertyCommand : public cmCommand
+{
+public:
+ cmSetPropertyCommand();
+
+ virtual cmCommand* Clone()
+ {
+ return new cmSetPropertyCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the input file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args);
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() { return "set_property";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Set a named property in a given scope.";
+ }
+
+ /**
+ * Longer documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ " set_property(<GLOBAL |\n"
+ " DIRECTORY [dir] |\n"
+ " TARGET [target1 [target2 ...]] |\n"
+ " SOURCE [src1 [src2 ...]] |\n"
+ " TEST [test1 [test2 ...]]>\n"
+ " [APPEND]\n"
+ " PROPERTY <name> [value1 [value2 ...]])\n"
+ "Set one property on zero or more objects of a scope. "
+ "The first argument determines the scope in which the property "
+ "is set. It must be one of the following:\n"
+ "GLOBAL scope is unique and does not accept a name.\n"
+ "DIRECTORY scope defaults to the current directory but another "
+ "directory (already processed by CMake) may be named by full or "
+ "relative path.\n"
+ "TARGET scope may name zero or more existing targets.\n"
+ "SOURCE scope may name zero or more source files.\n"
+ "TEST scope may name zero or more existing tests.\n"
+ "The required PROPERTY option is immediately followed by the name "
+ "of the property to set. Remaining arguments are used to "
+ "compose the property value in the form of a semicolon-separated "
+ "list. "
+ "If the APPEND option is given the list is appended to any "
+ "existing property value."
+ ;
+ }
+
+ /**
+ * This determines if the command is invoked when in script mode.
+ */
+ virtual bool IsScriptable() { return true; }
+
+ cmTypeMacro(cmSetPropertyCommand, cmCommand);
+
+private:
+ std::set<cmStdString> Names;
+ std::string PropertyName;
+ std::string PropertyValue;
+ bool AppendMode;
+
+ // Implementation of value construction.
+ bool ConstructValue(std::string& value, const char* old);
+
+ // Implementation of each property type.
+ bool HandleGlobalMode();
+ bool HandleDirectoryMode();
+ bool HandleTargetMode();
+ bool HandleTarget(cmTarget* target);
+ bool HandleSourceMode();
+ bool HandleSource(cmSourceFile* sf);
+ bool HandleTestMode();
+ bool HandleTest(cmTest* test);
+};
+
+
+
+#endif