diff options
author | Brad King <brad.king@kitware.com> | 2022-11-22 16:19:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-11-22 16:26:28 (GMT) |
commit | 80fc564dd7cbebc374a18fb57c71472dac5de6c1 (patch) | |
tree | ed2af4b1fc85a3c4c36cdd77cca2e43d276ed065 /Source/cmCoreTryCompile.cxx | |
parent | 0a802d0f9ef2b0a0150382d6e988f5d2a78eeb64 (diff) | |
download | CMake-80fc564dd7cbebc374a18fb57c71472dac5de6c1.zip CMake-80fc564dd7cbebc374a18fb57c71472dac5de6c1.tar.gz CMake-80fc564dd7cbebc374a18fb57c71472dac5de6c1.tar.bz2 |
try_compile: Restore COPY_FILE with CMAKE_TRY_COMPILE_CONFIGURATION
Since commit 0c141b0393 (try_compile: Record output location instead of
reverse computing it, 2022-08-31, v3.25.0-rc1~154^2) we always look for
the "Debug" configuration's output binary from the test project.
Restore looking for the `CMAKE_TRY_COMPILE_CONFIGURATION`.
Fixes: #24180
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-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"; |