1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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 cmAddDefinitionsCommand_h
13 #define cmAddDefinitionsCommand_h
15 #include "cmCommand.h"
17 /** \class cmAddDefinitionsCommand
18 * \brief Specify a list of compiler defines
20 * cmAddDefinitionsCommand specifies a list of compiler defines. These defines
21 * will be added to the compile command.
23 class cmAddDefinitionsCommand : public cmCommand
27 * This is a virtual constructor for the command.
29 virtual cmCommand* Clone()
31 return new cmAddDefinitionsCommand;
35 * This is called when the command is first encountered in
36 * the CMakeLists.txt file.
38 virtual bool InitialPass(std::vector<std::string> const& args,
39 cmExecutionStatus &status);
42 * The name of the command as specified in CMakeList.txt.
44 virtual const char* GetName() const {return "add_definitions";}
47 * Succinct documentation.
49 virtual const char* GetTerseDocumentation() const
51 return "Adds -D define flags to the compilation of source files.";
57 virtual const char* GetFullDocumentation() const
60 " add_definitions(-DFOO -DBAR ...)\n"
61 "Adds flags to the compiler command line for sources in the current "
62 "directory and below. This command can be used to add any flags, "
63 "but it was originally intended to add preprocessor definitions. "
64 "Flags beginning in -D or /D that look like preprocessor definitions "
65 "are automatically added to the COMPILE_DEFINITIONS property for "
66 "the current directory. Definitions with non-trival values may be "
67 "left in the set of flags instead of being converted for reasons of "
68 "backwards compatibility. See documentation of the directory, "
69 "target, and source file COMPILE_DEFINITIONS properties for details "
70 "on adding preprocessor definitions to specific scopes and "
75 cmTypeMacro(cmAddDefinitionsCommand, cmCommand);
77 bool ParseDefinition(std::string const& def);