diff options
Diffstat (limited to 'Source/cmQtAutoGenGlobalInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGenGlobalInitializer.cxx | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index ef8a56b..751ad50 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -1,23 +1,25 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGenGlobalInitializer.h" -#include "cmQtAutoGen.h" -#include "cmQtAutoGenInitializer.h" -#include "cmAlgorithms.h" #include "cmCustomCommandLines.h" +#include "cmCustomCommandTypes.h" #include "cmDuration.h" #include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmProcessOutput.h" +#include "cmQtAutoGen.h" +#include "cmQtAutoGenInitializer.h" #include "cmState.h" #include "cmStateTypes.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include <memory> +#include <cm/memory> + #include <utility> cmQtAutoGenGlobalInitializer::Keywords::Keywords() @@ -48,8 +50,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( { cmMakefile* makefile = localGen->GetMakefile(); // Detect global autogen target name - if (cmSystemTools::IsOn( - makefile->GetSafeDefinition("CMAKE_GLOBAL_AUTOGEN_TARGET"))) { + if (cmIsOn(makefile->GetSafeDefinition("CMAKE_GLOBAL_AUTOGEN_TARGET"))) { std::string targetName = makefile->GetSafeDefinition("CMAKE_GLOBAL_AUTOGEN_TARGET_NAME"); if (targetName.empty()) { @@ -60,8 +61,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( } // Detect global autorcc target name - if (cmSystemTools::IsOn( - makefile->GetSafeDefinition("CMAKE_GLOBAL_AUTORCC_TARGET"))) { + if (cmIsOn(makefile->GetSafeDefinition("CMAKE_GLOBAL_AUTORCC_TARGET"))) { std::string targetName = makefile->GetSafeDefinition("CMAKE_GLOBAL_AUTORCC_TARGET_NAME"); if (targetName.empty()) { @@ -119,23 +119,17 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const uicDisabled = (uic && !uicAvailable); bool const rccDisabled = (rcc && !rccAvailable); if (mocDisabled || uicDisabled || rccDisabled) { - std::string msg = "AUTOGEN: No valid Qt version found for target "; - msg += target->GetName(); - msg += ". "; - msg += cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled); - msg += " disabled. Consider adding:\n"; - { - std::string version = (qtVersion.second == 0) - ? std::string("<QTVERSION>") - : std::to_string(qtVersion.second); - std::string comp = uicDisabled ? "Widgets" : "Core"; - msg += " find_package(Qt"; - msg += version; - msg += " COMPONENTS "; - msg += comp; - msg += ")\n"; - } - msg += "to your CMakeLists.txt file."; + cmAlphaNum version = (qtVersion.second == 0) + ? cmAlphaNum("<QTVERSION>") + : cmAlphaNum(qtVersion.second); + cmAlphaNum component = uicDisabled ? "Widgets" : "Core"; + + std::string const msg = cmStrCat( + "AUTOGEN: No valid Qt version found for target ", + target->GetName(), ". ", + cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled), + " disabled. Consider adding:\n", " find_package(Qt", version, + " COMPONENTS ", component, ")\n", "to your CMakeLists.txt file."); target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg); } if (mocIsValid || uicIsValid || rccIsValid) { @@ -161,7 +155,7 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget( // Create utility target cmTarget* target = makefile->AddUtilityCommand( - name, cmMakefile::TargetOrigin::Generator, true, + name, cmCommandOrigin::Generator, true, makefile->GetHomeOutputDirectory().c_str() /*work dir*/, std::vector<std::string>() /*output*/, std::vector<std::string>() /*depends*/, cmCustomCommandLines(), false, @@ -218,11 +212,8 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures( // Check if the executable exists if (!cmSystemTools::FileExists(executable, true)) { - error = "The \""; - error += generator; - error += "\" executable "; - error += cmQtAutoGen::Quoted(executable); - error += " does not exist."; + error = cmStrCat("The \"", generator, "\" executable ", + cmQtAutoGen::Quoted(executable), " does not exist."); return cmQtAutoGen::CompilerFeaturesHandle(); } @@ -238,15 +229,10 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures( command, &stdOut, &stdErr, &retVal, nullptr, cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); if (!runResult) { - error = "Test run of \""; - error += generator; - error += "\" executable "; - error += cmQtAutoGen::Quoted(executable) + " failed.\n"; - error += cmQtAutoGen::QuotedCommand(command); - error += "\n"; - error += stdOut; - error += "\n"; - error += stdErr; + error = cmStrCat("Test run of \"", generator, "\" executable ", + cmQtAutoGen::Quoted(executable), " failed.\n", + cmQtAutoGen::QuotedCommand(command), '\n', stdOut, '\n', + stdErr); return cmQtAutoGen::CompilerFeaturesHandle(); } } |