Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmIncludeCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmIncludeCommand_h
13 #define cmIncludeCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmIncludeCommand
18  * \brief
19  *
20  *  cmIncludeCommand defines a list of distant
21  *  files that can be "included" in the current list file.
22  *  In almost every sense, this is identical to a C/C++
23  *  #include command.  Arguments are first expended as usual.
24  */
25 class cmIncludeCommand : public cmCommand
26 {
27 public:
28   /**
29    * This is a virtual constructor for the command.
30    */
31   virtual cmCommand* Clone()
32     {
33     return new cmIncludeCommand;
34     }
35
36   /**
37    * This is called when the command is first encountered in
38    * the CMakeLists.txt file.
39    */
40   virtual bool InitialPass(std::vector<std::string> const& args,
41                            cmExecutionStatus &status);
42
43   /**
44    * This determines if the command is invoked when in script mode.
45    */
46   virtual bool IsScriptable() const { return true; }
47
48   /**
49    * The name of the command as specified in CMakeList.txt.
50    */
51   virtual const char* GetName() const {return "include";}
52
53   /**
54    * Succinct documentation.
55    */
56   virtual const char* GetTerseDocumentation() const
57     {
58     return "Load and run CMake code from a file or module.";
59     }
60
61   /**
62    * More documentation.
63    */
64   virtual const char* GetFullDocumentation() const
65     {
66     return
67       "  include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>]\n"
68       "                        [NO_POLICY_SCOPE])\n"
69       "Load and run CMake code from the file given.  "
70       "Variable reads and writes access the scope of the caller "
71       "(dynamic scoping).  "
72       "If OPTIONAL is present, then no error "
73       "is raised if the file does not exist.  If RESULT_VARIABLE is given "
74       "the variable will be set to the full filename which "
75       "has been included or NOTFOUND if it failed.\n"
76       "If a module is specified instead of a file, the file with name "
77       "<modulename>.cmake is searched first in CMAKE_MODULE_PATH, then in the "
78       "CMake module directory. There is one exception to this: if the file "
79       "which calls include() is located itself in the CMake module directory, "
80       "then first the CMake module directory is searched and "
81       "CMAKE_MODULE_PATH afterwards. See also policy CMP0017."
82       "\n"
83       "See the cmake_policy() command documentation for discussion of the "
84       "NO_POLICY_SCOPE option."
85       ;
86     }
87
88   cmTypeMacro(cmIncludeCommand, cmCommand);
89 };
90
91
92
93 #endif