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 | |
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')
-rw-r--r-- | Source/cmPolicies.h | 3 | ||||
-rw-r--r-- | Source/cmTargetCompileOptionsCommand.cxx | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 8d292ac..eef41c0 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -299,6 +299,9 @@ class cmMakefile; "libraries.", \ 3, 17, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3, \ + 17, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0101, \ + "target_compile_options honors BEFORE keyword in all scopes.", 3, \ 17, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) 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. } |