Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmTargetCompileOptionsCommand.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 cmTargetCompileOptionsCommand_h
14 #define cmTargetCompileOptionsCommand_h
15
16 #include "cmTargetPropCommandBase.h"
17
18 class cmTargetCompileOptionsCommand : public cmTargetPropCommandBase
19 {
20 public:
21   /**
22    * This is a virtual constructor for the command.
23    */
24   virtual cmCommand* Clone()
25     {
26     return new cmTargetCompileOptionsCommand;
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_options";}
40
41   /**
42    * Succinct documentation.
43    */
44   virtual const char* GetTerseDocumentation() const
45     {
46     return
47       "Add compile options to a target.";
48     }
49
50   /**
51    * More documentation.
52    */
53   virtual const char* GetFullDocumentation() const
54     {
55     return
56       "  target_compile_options(<target> [BEFORE] "
57       "<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
58       "    [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
59       "Specify compile options 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       "If BEFORE is specified, the content will be prepended to the property "
63       "instead of being appended.\n"
64       "The INTERFACE, PUBLIC and PRIVATE keywords are required to specify "
65       "the scope of the following arguments.  PRIVATE and PUBLIC items will "
66       "populate the COMPILE_OPTIONS property of <target>.  PUBLIC and "
67       "INTERFACE items will populate the INTERFACE_COMPILE_OPTIONS "
68       "property of <target>.   "
69       "The following arguments specify compile opitions.  "
70       "Repeated calls for the same <target> append items in the order called."
71       "\n"
72       "Arguments to target_compile_options may use \"generator "
73       "expressions\" with the syntax \"$<...>\".  "
74       CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
75       ;
76     }
77
78   cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase);
79
80 private:
81   virtual void HandleImportedTarget(const std::string &tgt);
82   virtual void HandleMissingTarget(const std::string &name);
83
84   virtual void HandleDirectContent(cmTarget *tgt,
85                                    const std::vector<std::string> &content,
86                                    bool prepend, bool system);
87   virtual std::string Join(const std::vector<std::string> &content);
88 };
89
90 #endif