Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmTargetCompileDefinitionsCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2013 Stephen Kelly <steveire@gmail.com>
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
13 #ifndef cmTargetCompileDefinitionsCommand_h
14 #define cmTargetCompileDefinitionsCommand_h
15
16 #include "cmTargetPropCommandBase.h"
17
18 class cmTargetCompileDefinitionsCommand : public cmTargetPropCommandBase
19 {
20 public:
21   /**
22    * This is a virtual constructor for the command.
23    */
24   virtual cmCommand* Clone()
25     {
26     return new cmTargetCompileDefinitionsCommand;
27     }
28
29   /**
30    * This is called when the command is first encountered in
31    * the CMakeLists.txt file.
32    */
33   virtual bool InitialPass(std::vector<std::string> const& args,
34                            cmExecutionStatus &status);
35
36   /**
37    * The name of the command as specified in CMakeList.txt.
38    */
39   virtual const char* GetName() const { return "target_compile_definitions";}
40
41   /**
42    * Succinct documentation.
43    */
44   virtual const char* GetTerseDocumentation() const
45     {
46     return
47       "Add compile definitions to a target.";
48     }
49
50   /**
51    * More documentation.
52    */
53   virtual const char* GetFullDocumentation() const
54     {
55     return
56       "  target_compile_definitions(<target> "
57       "<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
58       "    [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
59       "Specify compile definitions to use when compiling a given target.  "
60       "The named <target> must have been created by a command such as "
61       "add_executable or add_library and must not be an IMPORTED target.  "
62       "The INTERFACE, PUBLIC and PRIVATE keywords are required to specify "
63       "the scope of the following arguments.  PRIVATE and PUBLIC items will "
64       "populate the COMPILE_DEFINITIONS property of <target>.  PUBLIC and "
65       "INTERFACE items will populate the INTERFACE_COMPILE_DEFINITIONS "
66       "property of <target>.   "
67       "The following arguments specify compile definitions.  "
68       "Repeated calls for the same <target> append items in the order called."
69       "\n"
70       "Arguments to target_compile_definitions may use \"generator "
71       "expressions\" with the syntax \"$<...>\".  "
72       CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
73       ;
74     }
75
76   cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase);
77
78 private:
79   virtual void HandleImportedTarget(const std::string &tgt);
80   virtual void HandleMissingTarget(const std::string &name);
81
82   virtual void HandleDirectContent(cmTarget *tgt,
83                                    const std::vector<std::string> &content,
84                                    bool prepend, bool system);
85   virtual std::string Join(const std::vector<std::string> &content);
86 };
87
88 #endif