diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-10 18:13:09 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-11 00:25:25 (GMT) |
commit | 2678e310537a965b531cfc2c1f54fc72aac9d7d5 (patch) | |
tree | 6eaba42609646e732b70a71302095b87853d543e /Source/cmTargetCompileOptionsCommand.cxx | |
parent | 3795dea6f1d4ca9bc1a2131173ed190f6c362fbe (diff) | |
download | CMake-2678e310537a965b531cfc2c1f54fc72aac9d7d5.zip CMake-2678e310537a965b531cfc2c1f54fc72aac9d7d5.tar.gz CMake-2678e310537a965b531cfc2c1f54fc72aac9d7d5.tar.bz2 |
target_compile_options: ensure BEFORE keyword is handled in all scopes
Fixes: #20200
Diffstat (limited to 'Source/cmTargetCompileOptionsCommand.cxx')
-rw-r--r-- | Source/cmTargetCompileOptionsCommand.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index e39b726..dee2c10 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -5,6 +5,7 @@ #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmPolicies.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" #include "cmTargetPropCommandBase.h" @@ -27,10 +28,16 @@ private: bool HandleDirectContent(cmTarget* tgt, const std::vector<std::string>& content, - bool /*prepend*/, bool /*system*/) override + bool prepend, bool /*system*/) override { + cmPolicies::PolicyStatus policyStatus = + this->Makefile->GetPolicyStatus(cmPolicies::CMP0101); + if (policyStatus == cmPolicies::OLD || policyStatus == cmPolicies::WARN) { + prepend = false; + } + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - tgt->InsertCompileOption(this->Join(content), lfbt); + tgt->InsertCompileOption(this->Join(content), lfbt, prepend); return true; // Successfully handled. } |