Merge topic 'cuda-arch-cmp0104' into release-3.18

5bf9a290e7 CUDA: Fix CUDA_ARCHITECTURES policy CMP0104 check in try_compile

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4857
This commit is contained in:
Brad King
2020-06-05 15:00:52 +00:00
committed by Kitware Robot

View File

@@ -567,6 +567,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
*msvcRuntimeLibraryDefault ? "NEW" : "OLD");
}
/* Set CUDA architectures policy to match outer project. */
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0104) !=
cmPolicies::NEW &&
testLangs.find("CUDA") != testLangs.end() &&
this->Makefile->GetSafeDefinition(kCMAKE_CUDA_ARCHITECTURES).empty()) {
fprintf(fout, "cmake_policy(SET CMP0104 OLD)\n");
}
std::string projectLangs;
for (std::string const& li : testLangs) {
projectLangs += " " + li;