Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Source / cmIncludeDirectoryCommand.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 cmIncludeDirectoryCommand_h
13 #define cmIncludeDirectoryCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmIncludeDirectoryCommand
18  * \brief Add include directories to the build.
19  *
20  * cmIncludeDirectoryCommand is used to specify directory locations
21  * to search for included files.
22  */
23 class cmIncludeDirectoryCommand : public cmCommand
24 {
25 public:
26   /**
27    * This is a virtual constructor for the command.
28    */
29   virtual cmCommand* Clone()
30     {
31     return new cmIncludeDirectoryCommand;
32     }
33
34   /**
35    * This is called when the command is first encountered in
36    * the CMakeLists.txt file.
37    */
38   virtual bool InitialPass(std::vector<std::string> const& args,
39                            cmExecutionStatus &status);
40
41   /**
42    * The name of the command as specified in CMakeList.txt.
43    */
44   virtual const char* GetName() const { return "include_directories";}
45
46   /**
47    * Succinct documentation.
48    */
49   virtual const char* GetTerseDocumentation() const
50     {
51     return "Add include directories to the build.";
52     }
53
54   /**
55    * More documentation.
56    */
57   virtual const char* GetFullDocumentation() const
58     {
59     return
60       "  include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n"
61       "Add the given directories to those the compiler uses to search "
62       "for include files.  Relative paths are interpreted as relative to "
63       "the current source directory. \n"
64       "The include directories are added to the directory property "
65       "INCLUDE_DIRECTORIES for the current CMakeLists file. "
66       "They are also added to the target property INCLUDE_DIRECTORIES "
67       "for each target in the current CMakeLists file. "
68       "The target property values are the ones used by the generators."
69       "\n"
70       "By default the directories are appended onto the current list of "
71       "directories. "
72       "This default behavior can be changed by setting "
73       "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
74       "By using AFTER or BEFORE explicitly, you can select between "
75       "appending and prepending, independent of the default. "
76       "\n"
77       "If the SYSTEM option is given, the compiler will be told the "
78       "directories are meant as system include directories on some "
79       "platforms (signalling this setting might achieve effects such as "
80       "the compiler skipping warnings, or these fixed-install system files "
81       "not being considered in dependency calculations - see compiler docs).";
82     }
83
84   cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
85
86 protected:
87   // used internally
88   void GetIncludes(const std::string &arg, std::vector<std::string> &incs);
89   void NormalizeInclude(std::string &inc);
90 };
91
92
93
94 #endif