summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-17 12:57:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-05-17 12:57:55 (GMT)
commita7cd15a61c5708ba50482ee485b4c102146861d0 (patch)
treed55e53a1b1085ed39f251fbf804a72c7fd2b09a8 /Source
parent20ed6f697e997f597b1e60d16edf711792e94965 (diff)
parenta6562ff57908e6f03ef44eb0438ba9937f28174c (diff)
downloadCMake-a7cd15a61c5708ba50482ee485b4c102146861d0.zip
CMake-a7cd15a61c5708ba50482ee485b4c102146861d0.tar.gz
CMake-a7cd15a61c5708ba50482ee485b4c102146861d0.tar.bz2
Merge topic 'try_compile-project-platform-vars'
a6562ff579 try_compile: Add option to skip passing platform variables 4843a37676 try_compile: Propagate platform variables in project-mode too Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !7265
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx5
-rw-r--r--Source/cmPolicies.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 4909948..caa413b 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -872,7 +872,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
// Forward a set of variables to the inner project cache.
- if (this->SrcFileSignature) {
+ if ((this->SrcFileSignature ||
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0137) ==
+ cmPolicies::NEW) &&
+ !this->Makefile->IsOn("CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES")) {
std::set<std::string> vars;
vars.insert(&c_properties[lang_property_start],
&c_properties[lang_property_start + lang_property_size]);
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 4977083..c8b037e 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -411,7 +411,10 @@ class cmMakefile;
3, 24, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0136, \
"Watcom runtime library flags are selected by an abstraction.", 3, \
- 24, 0, cmPolicies::WARN)
+ 24, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0137, \
+ "try_compile() passes platform variables in project mode", 3, 24, 0, \
+ cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \