diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-06-04 08:30:24 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-04 09:36:55 (GMT) |
commit | a984f3257e95f29a72da6566859d4c6a8a5d749b (patch) | |
tree | f174238c2d4c5b582fd5f892ea1c64e2b8418c06 /Source/cmTarget.cxx | |
parent | 00c3840cc8c36adea76c6e833a9e2069645aec8a (diff) | |
download | CMake-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/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f1d0ac3..eb1e3b2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -297,7 +297,7 @@ void cmTarget::DefineProperties(cmake *cm) "List of options to pass to the compiler.", "This property specifies the list of options specified " "so far for this property. " - "This property exists on targets only. " + "This property exists on directories and targets. " "\n" "The target property values are used by the generators to set " "the options for the compiler.\n" @@ -1611,6 +1611,14 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->InsertInclude(*it); } + const std::vector<cmValueWithOrigin> parentOptions = + this->Makefile->GetCompileOptionsEntries(); + + for (std::vector<cmValueWithOrigin>::const_iterator it + = parentOptions.begin(); it != parentOptions.end(); ++it) + { + this->InsertCompileOption(*it); + } if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY || this->TargetTypeValue == cmTarget::MODULE_LIBRARY) |