1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddDefinitionsCommand.h,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.14 $
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 cmAddDefinitionsCommand_h
18 #define cmAddDefinitionsCommand_h
20 #include "cmCommand.h"
22 /** \class cmAddDefinitionsCommand
23 * \brief Specify a list of compiler defines
25 * cmAddDefinitionsCommand specifies a list of compiler defines. These defines
26 * will be added to the compile command.
28 class cmAddDefinitionsCommand
: public cmCommand
32 * This is a virtual constructor for the command.
34 virtual cmCommand
* Clone()
36 return new cmAddDefinitionsCommand
;
40 * This is called when the command is first encountered in
41 * the CMakeLists.txt file.
43 virtual bool InitialPass(std::vector
<std::string
> const& args
,
44 cmExecutionStatus
&status
);
47 * The name of the command as specified in CMakeList.txt.
49 virtual const char* GetName() {return "add_definitions";}
52 * Succinct documentation.
54 virtual const char* GetTerseDocumentation()
56 return "Adds -D define flags to the compilation of source files.";
62 virtual const char* GetFullDocumentation()
65 " add_definitions(-DFOO -DBAR ...)\n"
66 "Adds flags to the compiler command line for sources in the current "
67 "directory and below. This command can be used to add any flags, "
68 "but it was originally intended to add preprocessor definitions. "
69 "Flags beginning in -D or /D that look like preprocessor definitions "
70 "are automatically added to the COMPILE_DEFINITIONS property for "
71 "the current directory. Definitions with non-trival values may be "
72 "left in the set of flags instead of being converted for reasons of "
73 "backwards compatibility. See documentation of the directory, "
74 "target, and source file COMPILE_DEFINITIONS properties for details "
75 "on adding preprocessor definitions to specific scopes and "
80 cmTypeMacro(cmAddDefinitionsCommand
, cmCommand
);
82 bool ParseDefinition(std::string
const& def
);