BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmGetPropertyCommand.h
blob25bde0965c10ab5d5357d6a2d0aaccec092122bc
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmGetPropertyCommand.h,v $
5 Language: C++
6 Date: $Date: 2008-09-04 17:15:18 $
7 Version: $Revision: 1.8 $
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 cmGetPropertyCommand_h
18 #define cmGetPropertyCommand_h
20 #include "cmCommand.h"
22 class cmGetPropertyCommand : public cmCommand
24 public:
25 cmGetPropertyCommand();
27 virtual cmCommand* Clone()
29 return new cmGetPropertyCommand;
32 /**
33 * This is called when the command is first encountered in
34 * the input file.
36 virtual bool InitialPass(std::vector<std::string> const& args,
37 cmExecutionStatus &status);
39 /**
40 * This determines if the command is invoked when in script mode.
42 virtual bool IsScriptable() { return true; }
44 /**
45 * The name of the command as specified in CMakeList.txt.
47 virtual const char* GetName() { return "get_property";}
49 /**
50 * Succinct documentation.
52 virtual const char* GetTerseDocumentation()
54 return "Get a property.";
57 /**
58 * Longer documentation.
60 virtual const char* GetFullDocumentation()
62 return
63 " get_property(<variable>\n"
64 " <GLOBAL |\n"
65 " DIRECTORY [dir] |\n"
66 " TARGET <target> |\n"
67 " SOURCE <source> |\n"
68 " TEST <test> |\n"
69 " VARIABLE>\n"
70 " PROPERTY <name>\n"
71 " [SET | DEFINED | BRIEF_DOCS | FULL_DOCS])\n"
72 "Get one property from one object in a scope. "
73 "The first argument specifies the variable in which to store the "
74 "result. "
75 "The second argument determines the scope from which to get the "
76 "property. It must be one of the following:\n"
77 "GLOBAL scope is unique and does not accept a name.\n"
78 "DIRECTORY scope defaults to the current directory but another "
79 "directory (already processed by CMake) may be named by full or "
80 "relative path.\n"
81 "TARGET scope must name one existing target.\n"
82 "SOURCE scope must name one source file.\n"
83 "TEST scope must name one existing test.\n"
84 "VARIABLE scope is unique and does not accept a name.\n"
85 "The required PROPERTY option is immediately followed by the name "
86 "of the property to get. "
87 "If the property is not set an empty value is returned. "
88 "If the SET option is given the variable is set to a boolean "
89 "value indicating whether the property has been set. "
90 "If the DEFINED option is given the variable is set to a boolean "
91 "value indicating whether the property has been defined "
92 "such as with define_property. "
93 "If BRIEF_DOCS or FULL_DOCS is given then the variable is set to "
94 "a string containing documentation for the requested property. "
95 "If documentation is requested for a property that has not been "
96 "defined NOTFOUND is returned.";
99 cmTypeMacro(cmGetPropertyCommand, cmCommand);
100 private:
101 enum OutType { OutValue, OutDefined, OutBriefDoc, OutFullDoc, OutSet };
102 std::string Variable;
103 std::string Name;
104 std::string PropertyName;
105 OutType InfoType;
107 // Implementation of result storage.
108 bool StoreResult(const char* value);
110 // Implementation of each property type.
111 bool HandleGlobalMode();
112 bool HandleDirectoryMode();
113 bool HandleTargetMode();
114 bool HandleSourceMode();
115 bool HandleTestMode();
116 bool HandleVariableMode();
119 #endif