diff options
author | Brad King <brad.king@kitware.com> | 2022-11-23 12:09:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-11-23 12:09:10 (GMT) |
commit | af937d2933f2b8d09c8540e4377ef337152c2240 (patch) | |
tree | a49e0d7f0b91403b9d36ddbff5dc005ece854092 /Source | |
parent | a195dd2a6c7029c2466667455d0ff6fd5effb713 (diff) | |
parent | 80fc564dd7cbebc374a18fb57c71472dac5de6c1 (diff) | |
download | CMake-af937d2933f2b8d09c8540e4377ef337152c2240.zip CMake-af937d2933f2b8d09c8540e4377ef337152c2240.tar.gz CMake-af937d2933f2b8d09c8540e4377ef337152c2240.tar.bz2 |
Merge topic 'try_compile-copy-config'
80fc564dd7 try_compile: Restore COPY_FILE with CMAKE_TRY_COMPILE_CONFIGURATION
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !7948
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 867f984..b44111d 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -206,6 +206,8 @@ auto const TryRunSourcesArgParser = auto const TryRunOldArgParser = makeTryRunParser(TryCompileOldArgParser); #undef BIND_LANG_PROPS + +std::string const TryCompileDefaultConfig = "DEBUG"; } Arguments cmCoreTryCompile::ParseArgs( @@ -706,9 +708,9 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments, CM_FALLTHROUGH; case cmPolicies::NEW: { // NEW behavior is to pass config-specific compiler flags. - static std::string const cfgDefault = "DEBUG"; - std::string const cfg = - !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault; + std::string const cfg = !tcConfig.empty() + ? cmSystemTools::UpperCase(tcConfig) + : TryCompileDefaultConfig; for (std::string const& li : testLangs) { std::string const langFlagsCfg = cmStrCat("CMAKE_", li, "_FLAGS_", cfg); @@ -1199,7 +1201,12 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName) tmpOutputFile += targetName; if (this->Makefile->GetGlobalGenerator()->IsMultiConfig()) { - tmpOutputFile += "_DEBUG"; + std::string const tcConfig = + this->Makefile->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); + std::string const cfg = !tcConfig.empty() + ? cmSystemTools::UpperCase(tcConfig) + : TryCompileDefaultConfig; + tmpOutputFile = cmStrCat(tmpOutputFile, '_', cfg); } tmpOutputFile += "_loc"; |