diff options
author | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2023-10-13 17:14:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-10-13 18:16:26 (GMT) |
commit | c074f5c81e04c032c976862a379297b8ba3bf3f8 (patch) | |
tree | e8b3727f0ad440b604dc343da8e4a8ed19446189 /Source/cmQtAutoGenGlobalInitializer.cxx | |
parent | 06a9b25b17759d754e2b542b8464f01a90e92a8e (diff) | |
download | CMake-c074f5c81e04c032c976862a379297b8ba3bf3f8.zip CMake-c074f5c81e04c032c976862a379297b8ba3bf3f8.tar.gz CMake-c074f5c81e04c032c976862a379297b8ba3bf3f8.tar.bz2 |
Autogen: Revert "AUTO*_EXECUTABLE: add support for per-config values"
Changing the `timestamp` file to `timestamp_$<CONFIG>` causes some user
projects to break when using Qt versions older than 6.6.
Revert commit fddd0f0443 (Autogen: AUTO*_EXECUTABLE: add support for
per-config values, 2023-06-14, v3.28.0-rc1~96^2~1) pending further
investigation.
Issue: #20074
Diffstat (limited to 'Source/cmQtAutoGenGlobalInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGenGlobalInitializer.cxx | 91 |
1 files changed, 18 insertions, 73 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 214df25..1da8847 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -213,81 +213,24 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoRcc( } } -cmQtAutoGen::ConfigStrings<cmQtAutoGen::CompilerFeaturesHandle> +cmQtAutoGen::CompilerFeaturesHandle cmQtAutoGenGlobalInitializer::GetCompilerFeatures( - std::string const& generator, cmQtAutoGen::ConfigString const& executable, - std::string& error, bool const isMultiConfig) + std::string const& generator, std::string const& executable, + std::string& error) { - cmQtAutoGen::ConfigStrings<cmQtAutoGen::CompilerFeaturesHandle> res; - if (isMultiConfig) { - for (auto const& config : executable.Config) { - auto const exe = config.second; - // Check if we have cached features - { - auto it = this->CompilerFeatures_.Config[config.first].find(exe); - if (it != this->CompilerFeatures_.Config[config.first].end()) { - res.Config[config.first] = it->second; - continue; - } - } - - // Check if the executable exists - if (!cmSystemTools::FileExists(exe, true)) { - error = cmStrCat("The \"", generator, "\" executable ", - cmQtAutoGen::Quoted(exe), " does not exist."); - res.Config[config.first] = {}; - continue; - } - - // Test the executable - std::string stdOut; - { - std::string stdErr; - std::vector<std::string> command; - command.emplace_back(exe); - command.emplace_back("-h"); - int retVal = 0; - const bool runResult = cmSystemTools::RunSingleCommand( - command, &stdOut, &stdErr, &retVal, nullptr, - cmSystemTools::OUTPUT_NONE, cmDuration::zero(), - cmProcessOutput::Auto); - if (!runResult) { - error = cmStrCat("Test run of \"", generator, "\" executable ", - cmQtAutoGen::Quoted(exe), " failed.\n", - cmQtAutoGen::QuotedCommand(command), '\n', stdOut, - '\n', stdErr); - res.Config[config.first] = {}; - continue; - } - } - - // Create valid handle - res.Config[config.first] = - std::make_shared<cmQtAutoGen::CompilerFeatures>(); - res.Config[config.first]->HelpOutput = std::move(stdOut); - - // Register compiler features - this->CompilerFeatures_.Config[config.first].emplace( - exe, res.Config[config.first]); - } - return res; - } - // Check if we have cached features { - auto it = this->CompilerFeatures_.Default.find(executable.Default); - if (it != this->CompilerFeatures_.Default.end()) { - res.Default = it->second; - return res; + auto it = this->CompilerFeatures_.find(executable); + if (it != this->CompilerFeatures_.end()) { + return it->second; } } // Check if the executable exists - if (!cmSystemTools::FileExists(executable.Default, true)) { - error = - cmStrCat("The \"", generator, "\" executable ", - cmQtAutoGen::Quoted(executable.Default), " does not exist."); - return cmQtAutoGen::ConfigStrings<cmQtAutoGen::CompilerFeaturesHandle>(); + if (!cmSystemTools::FileExists(executable, true)) { + error = cmStrCat("The \"", generator, "\" executable ", + cmQtAutoGen::Quoted(executable), " does not exist."); + return cmQtAutoGen::CompilerFeaturesHandle(); } // Test the executable @@ -295,7 +238,7 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures( { std::string stdErr; std::vector<std::string> command; - command.emplace_back(executable.Default); + command.emplace_back(executable); command.emplace_back("-h"); int retVal = 0; const bool runResult = cmSystemTools::RunSingleCommand( @@ -303,18 +246,20 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures( cmDuration::zero(), cmProcessOutput::Auto); if (!runResult) { error = cmStrCat("Test run of \"", generator, "\" executable ", - cmQtAutoGen::Quoted(executable.Default), " failed.\n", + cmQtAutoGen::Quoted(executable), " failed.\n", cmQtAutoGen::QuotedCommand(command), '\n', stdOut, '\n', stdErr); - return cmQtAutoGen::ConfigStrings<cmQtAutoGen::CompilerFeaturesHandle>(); + return cmQtAutoGen::CompilerFeaturesHandle(); } } - res.Default = std::make_shared<cmQtAutoGen::CompilerFeatures>(); - res.Default->HelpOutput = std::move(stdOut); + // Create valid handle + cmQtAutoGen::CompilerFeaturesHandle res = + std::make_shared<cmQtAutoGen::CompilerFeatures>(); + res->HelpOutput = std::move(stdOut); // Register compiler features - this->CompilerFeatures_.Default.emplace(executable.Default, res.Default); + this->CompilerFeatures_.emplace(executable, res); return res; } |