diff options
author | Brad King <brad.king@kitware.com> | 2022-05-16 14:16:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-16 14:47:21 (GMT) |
commit | a6562ff57908e6f03ef44eb0438ba9937f28174c (patch) | |
tree | 66891e45efadaa7589705021e66d96a476088e82 /Source | |
parent | 4843a376767c2c4b46e29ed85ac823443317ca40 (diff) | |
download | CMake-a6562ff57908e6f03ef44eb0438ba9937f28174c.zip CMake-a6562ff57908e6f03ef44eb0438ba9937f28174c.tar.gz CMake-a6562ff57908e6f03ef44eb0438ba9937f28174c.tar.bz2 |
try_compile: Add option to skip passing platform variables
Add a `CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES` variable to tell
`try_compile` not to pass platform variables to the test project.
Issue: #23219
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 39c2b3a..caa413b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -872,9 +872,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, } // Forward a set of variables to the inner project cache. - if (this->SrcFileSignature || - this->Makefile->GetPolicyStatus(cmPolicies::CMP0137) == - cmPolicies::NEW) { + 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]); |