summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCompileOptionsCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-06-04 08:30:24 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-06-04 09:36:55 (GMT)
commita984f3257e95f29a72da6566859d4c6a8a5d749b (patch)
treef174238c2d4c5b582fd5f892ea1c64e2b8418c06 /Source/cmAddCompileOptionsCommand.cxx
parent00c3840cc8c36adea76c6e833a9e2069645aec8a (diff)
downloadCMake-a984f3257e95f29a72da6566859d4c6a8a5d749b.zip
CMake-a984f3257e95f29a72da6566859d4c6a8a5d749b.tar.gz
CMake-a984f3257e95f29a72da6566859d4c6a8a5d749b.tar.bz2
Introduce add_compile_options command.
This command is similar to add_definitions, in that it affects the compile options of all targets which follow it. The implementation is similar to the implementation of the include_directories command, in that it is based on populating a COMPILE_OPTIONS directory property and using that to initialize the same property on targets. Unlike the include_directories command however, the add_compile_options command does not affect previously defined targets. That is, in the following code, foo will not be compiled with -Wall, but bar will be: add_library(foo ...) add_compile_options(-Wall) add_library(bar ...)
Diffstat (limited to 'Source/cmAddCompileOptionsCommand.cxx')
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
new file mode 100644
index 0000000..a6c3c00
--- /dev/null
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Stephen Kelly <steveire@gmail.com>
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmAddCompileOptionsCommand.h"
+
+bool cmAddCompileOptionsCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
+{
+ if(args.size() < 1 )
+ {
+ return true;
+ }
+
+ for(std::vector<std::string>::const_iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ this->Makefile->AddCompileOption(i->c_str());
+ }
+ return true;
+}