diff options
author | Brad King <brad.king@kitware.com> | 2021-07-19 20:28:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-07-20 13:47:02 (GMT) |
commit | 144be54dd31ad1320e3efa9b2b30876dcadd590a (patch) | |
tree | dc5f0b80d11162a245e6c5b1b1c98db5f38be997 /Source/cmCoreTryCompile.cxx | |
parent | 4ff651eb52215ca0e1ffe5e5356b56b57913fee0 (diff) | |
download | CMake-144be54dd31ad1320e3efa9b2b30876dcadd590a.zip CMake-144be54dd31ad1320e3efa9b2b30876dcadd590a.tar.gz CMake-144be54dd31ad1320e3efa9b2b30876dcadd590a.tar.bz2 |
try_compile: Propagate CMP0126 to the generated test project
Set policy CMP0126 to the value used in the calling project.
It may affect toolchain file behavior.
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 8ecf264..bf18143 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -570,6 +570,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, *cmp0123 == "NEW"_s ? "NEW" : "OLD"); } + /* Set cache/normal variable policy to match outer project. + It may affect toolchain files. */ + if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) != + cmPolicies::NEW) { + fprintf(fout, "cmake_policy(SET CMP0126 OLD)\n"); + } + std::string projectLangs; for (std::string const& li : testLangs) { projectLangs += " " + li; |