diff options
-rw-r--r-- | Help/manual/cmake-properties.7.rst | 3 | ||||
-rw-r--r-- | Help/prop_tgt/AUTOMOC.rst | 3 | ||||
-rw-r--r-- | Help/prop_tgt/AUTOMOC_EXECUTABLE.rst | 15 | ||||
-rw-r--r-- | Help/prop_tgt/AUTORCC.rst | 3 | ||||
-rw-r--r-- | Help/prop_tgt/AUTORCC_EXECUTABLE.rst | 15 | ||||
-rw-r--r-- | Help/prop_tgt/AUTOUIC.rst | 3 | ||||
-rw-r--r-- | Help/prop_tgt/AUTOUIC_EXECUTABLE.rst | 15 | ||||
-rw-r--r-- | Help/release/dev/autogen_executables.rst | 9 | ||||
-rw-r--r-- | Modules/BundleUtilities.cmake | 3 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmAlgorithms.h | 6 | ||||
-rw-r--r-- | Source/cmCPluginAPI.cxx | 2 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 13 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGenGlobalInitializer.cxx | 21 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 78 | ||||
-rw-r--r-- | Source/cmVSSetupHelper.cxx | 9 | ||||
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 2 | ||||
-rw-r--r-- | Source/cmWriteFileCommand.cxx | 2 | ||||
-rw-r--r-- | Utilities/Sphinx/colors.py | 10 |
23 files changed, 192 insertions, 64 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 047859d..df8f12c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -129,13 +129,16 @@ Properties on Targets /prop_tgt/AUTOGEN_TARGET_DEPENDS /prop_tgt/AUTOMOC_COMPILER_PREDEFINES /prop_tgt/AUTOMOC_DEPEND_FILTERS + /prop_tgt/AUTOMOC_EXECUTABLE /prop_tgt/AUTOMOC_MACRO_NAMES /prop_tgt/AUTOMOC_MOC_OPTIONS /prop_tgt/AUTOMOC /prop_tgt/AUTOUIC + /prop_tgt/AUTOUIC_EXECUTABLE /prop_tgt/AUTOUIC_OPTIONS /prop_tgt/AUTOUIC_SEARCH_PATHS /prop_tgt/AUTORCC + /prop_tgt/AUTORCC_EXECUTABLE /prop_tgt/AUTORCC_OPTIONS /prop_tgt/BINARY_DIR /prop_tgt/BUILD_RPATH diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst index 7a3fd48..3e6d560 100644 --- a/Help/prop_tgt/AUTOMOC.rst +++ b/Help/prop_tgt/AUTOMOC.rst @@ -58,6 +58,9 @@ source files at build time and invoke moc accordingly. This property is initialized by the value of the :variable:`CMAKE_AUTOMOC` variable if it is set when a target is created. +The ``moc`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTOMOC_EXECUTABLE` property. + Additional command line options for ``moc`` can be set via the :prop_tgt:`AUTOMOC_MOC_OPTIONS` property. diff --git a/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst b/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst new file mode 100644 index 0000000..6b66ce8 --- /dev/null +++ b/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTOMOC_EXECUTABLE +------------------ + +:prop_tgt:`AUTOMOC_EXECUTABLE` is file path pointing to the ``moc`` +executable to use for :prop_tgt:`AUTOMOC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``moc`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``moc`` can not work -- e.g. because +you are building the ``moc`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst index 27fb149..5db6ed0 100644 --- a/Help/prop_tgt/AUTORCC.rst +++ b/Help/prop_tgt/AUTORCC.rst @@ -21,6 +21,9 @@ If the ``.qrc`` file is :prop_sf:`GENERATED` though, a Additional command line options for rcc can be set via the :prop_sf:`AUTORCC_OPTIONS` source file property on the ``.qrc`` file. +The ``rcc`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTORCC_EXECUTABLE` property. + The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the autorcc targets together in an IDE, e.g. in MSVS. diff --git a/Help/prop_tgt/AUTORCC_EXECUTABLE.rst b/Help/prop_tgt/AUTORCC_EXECUTABLE.rst new file mode 100644 index 0000000..ca0fbd7 --- /dev/null +++ b/Help/prop_tgt/AUTORCC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTORCC_EXECUTABLE +------------------ + +:prop_tgt:`AUTORCC_EXECUTABLE` is file path pointing to the ``rcc`` +executable to use for :prop_tgt:`AUTORCC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``rcc`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``rcc`` can not work -- e.g. because +you are building the ``rcc`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst index 4f58b35..85226c1 100644 --- a/Help/prop_tgt/AUTOUIC.rst +++ b/Help/prop_tgt/AUTOUIC.rst @@ -30,6 +30,9 @@ Additional command line options for ``uic`` can be set via the The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the autouic targets together in an IDE, e.g. in MSVS. +The ``uic`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTOUIC_EXECUTABLE` property. + Source files can be excluded from :prop_tgt:`AUTOUIC` processing by enabling :prop_sf:`SKIP_AUTOUIC` or the broader :prop_sf:`SKIP_AUTOGEN`. diff --git a/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst b/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst new file mode 100644 index 0000000..03bd554 --- /dev/null +++ b/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTOUIC_EXECUTABLE +------------------ + +:prop_tgt:`AUTOUIC_EXECUTABLE` is file path pointing to the ``uic`` +executable to use for :prop_tgt:`AUTOUIC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``uic`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``uic`` can not work -- e.g. because +you are building the ``uic`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/release/dev/autogen_executables.rst b/Help/release/dev/autogen_executables.rst new file mode 100644 index 0000000..5e967ea --- /dev/null +++ b/Help/release/dev/autogen_executables.rst @@ -0,0 +1,9 @@ +AUTO*_EXECUTABLE +---------------- + +* The :prop_tgt:`AUTOMOC_EXECUTABLE`, :prop_tgt:`AUTORCC_EXECUTABLE` and + :prop_tgt:`AUTOUIC_EXECUTABLE` target properties all take a path to an + executable and force automoc/autorcc/autouic to use this executable. + + Setting these will also prevent the configure time testing for these + executables. This is mainly useful when you build these tools yourself. diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index d5c47f8..8c7646e 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -717,6 +717,9 @@ function(link_resolved_item_into_bundle resolved_item resolved_embedded_item) else() get_filename_component(target_dir "${resolved_embedded_item}" DIRECTORY) file(RELATIVE_PATH symlink_target "${target_dir}" "${resolved_item}") + if (NOT EXISTS "${target_dir}") + file(MAKE_DIRECTORY "${target_dir}") + endif() execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${symlink_target}" "${resolved_embedded_item}") endif() endfunction() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4bde35e..220040c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 13) -set(CMake_VERSION_PATCH 20190108) +set(CMake_VERSION_PATCH 20190110) #set(CMake_VERSION_RC 1) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index bbd3e8e..2f8e675 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -396,6 +396,12 @@ constexpr #endif +template <typename T> +int isize(const T& t) +{ + return static_cast<int>(cm::size(t)); +} + #if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L using std::cbegin; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 065a184..1d9621c 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -407,7 +407,7 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source, cmMakefile* mf = static_cast<cmMakefile*>(arg); std::string barf = source; std::string const& result = - mf->ExpandVariablesInString(barf, escapeQuotes, atOnly); + mf->ExpandVariablesInString(barf, escapeQuotes != 0, atOnly != 0); return strdup(result.c_str()); } diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index bbc90a2..2fa593c 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -59,18 +59,17 @@ void cmExtraCodeLiteGenerator::Generate() // and extract the information for creating the worspace // root makefile for (auto const& it : projectMap) { - const cmMakefile* mf = it.second[0]->GetMakefile(); + cmLocalGenerator* lg = it.second[0]; + const cmMakefile* mf = lg->GetMakefile(); this->ConfigName = GetConfigurationName(mf); - if (it.second[0]->GetCurrentBinaryDirectory() == - it.second[0]->GetBinaryDirectory()) { - workspaceOutputDir = it.second[0]->GetCurrentBinaryDirectory(); - workspaceProjectName = it.second[0]->GetProjectName(); - workspaceSourcePath = it.second[0]->GetSourceDirectory(); + if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) { + workspaceOutputDir = lg->GetCurrentBinaryDirectory(); + workspaceProjectName = lg->GetProjectName(); + workspaceSourcePath = lg->GetSourceDirectory(); workspaceFileName = workspaceOutputDir + "/"; workspaceFileName += workspaceProjectName + ".workspace"; - this->WorkspacePath = it.second[0]->GetCurrentBinaryDirectory(); - ; + this->WorkspacePath = lg->GetCurrentBinaryDirectory(); break; } } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 594cb67..fc9c1d2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -220,7 +220,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { #if defined(_MSC_VER) || defined(__MINGW32__) - writable = mode & S_IWRITE; + writable = (mode & S_IWRITE) != 0; mode_t newMode = mode | S_IWRITE; #else writable = mode & S_IWUSR; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2727d9a..96d4ad6 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -71,16 +71,11 @@ const std::string& cmCompiledGeneratorExpression::EvaluateWithContext( this->Output.clear(); - std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = - this->Evaluators.begin(); - const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = - this->Evaluators.end(); + for (const cmGeneratorExpressionEvaluator* it : this->Evaluators) { + this->Output += it->Evaluate(&context, dagChecker); - for (; it != end; ++it) { - this->Output += (*it)->Evaluate(&context, dagChecker); - - this->SeenTargetProperties.insert(context.SeenTargetProperties.begin(), - context.SeenTargetProperties.end()); + this->SeenTargetProperties.insert(context.SeenTargetProperties.cbegin(), + context.SeenTargetProperties.cend()); if (context.HadError) { this->Output.clear(); break; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 4d98d55..1a25633 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -196,7 +196,7 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config, std::string outputFilename(this->GetOutputFilename(config)); if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { - std::string const static_library_suffix = + std::string const& static_library_suffix = this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"); *this->GetFolderBuildStreams() << " -o \"" << outputDir << outputFilename << static_library_suffix @@ -478,10 +478,9 @@ void cmGhsMultiTargetGenerator::WriteSources( std::vector<cmSourceFile*> const& objectSources, std::map<const cmSourceFile*, std::string> const& objectNames) { - for (std::vector<cmSourceFile*>::const_iterator si = objectSources.begin(); - si != objectSources.end(); ++si) { + for (const cmSourceFile* sf : objectSources) { std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups()); - std::string const& sourceFullPath = (*si)->GetFullPath(); + std::string const& sourceFullPath = sf->GetFullPath(); cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); std::string sgPath = sourceGroup->GetFullName(); @@ -491,8 +490,8 @@ void cmGhsMultiTargetGenerator::WriteSources( this->LocalGenerator->GetBinaryDirectory().c_str(), sgPath, GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); - std::string fullSourcePath((*si)->GetFullPath()); - if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp") { + std::string fullSourcePath(sf->GetFullPath()); + if (sf->GetExtension() == "int" || sf->GetExtension() == "bsp") { *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; } else { // WORKAROUND: GHS MULTI needs the path to use backslashes without quotes @@ -501,12 +500,12 @@ void cmGhsMultiTargetGenerator::WriteSources( *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; } - if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && - "bsp" != (*si)->GetExtension()) { - this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); - if (objectNames.end() != objectNames.find(*si)) { + if ("ld" != sf->GetExtension() && "int" != sf->GetExtension() && + "bsp" != sf->GetExtension()) { + this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], sf); + if (objectNames.end() != objectNames.find(sf)) { *this->FolderBuildStreams[sgPath] - << " -o \"" << objectNames.find(*si)->second << "\"" << std::endl; + << " -o \"" << objectNames.find(sf)->second << "\"" << std::endl; } this->WriteObjectDir(this->FolderBuildStreams[sgPath], @@ -516,7 +515,7 @@ void cmGhsMultiTargetGenerator::WriteSources( } void cmGhsMultiTargetGenerator::WriteObjectLangOverride( - cmGeneratedFileStream* fileStream, cmSourceFile* sourceFile) + cmGeneratedFileStream* fileStream, const cmSourceFile* sourceFile) { const char* rawLangProp = sourceFile->GetProperty("LANGUAGE"); if (NULL != rawLangProp) { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 2cdf68e..e936b08 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -86,7 +86,7 @@ private: cmLocalGhsMultiGenerator* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget); static void WriteObjectLangOverride(cmGeneratedFileStream* fileStream, - cmSourceFile* sourceFile); + const cmSourceFile* sourceFile); static void WriteObjectDir(cmGeneratedFileStream* fileStream, std::string const& dir); std::string GetOutputDirectory(const std::string& config) const; diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 5470ec3..678ff14 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -75,13 +75,26 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const uic = target->GetPropertyAsBool("AUTOUIC"); bool const rcc = target->GetPropertyAsBool("AUTORCC"); if (moc || uic || rcc) { - // We support Qt4 and Qt5 + std::string const mocExec = + target->GetSafeProperty("AUTOMOC_EXECUTABLE"); + std::string const uicExec = + target->GetSafeProperty("AUTOUIC_EXECUTABLE"); + std::string const rccExec = + target->GetSafeProperty("AUTORCC_EXECUTABLE"); + + // We support Qt4, Qt5 and Qt6 auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); - if ((qtVersion.Major == 4) || (qtVersion.Major == 5)) { + bool const validQt = (qtVersion.Major == 4) || + (qtVersion.Major == 5) || (qtVersion.Major == 6); + bool const mocIsValid = moc && (validQt || !mocExec.empty()); + bool const uicIsValid = uic && (validQt || !uicExec.empty()); + bool const rccIsValid = rcc && (validQt || !rccExec.empty()); + + if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( - this, target, qtVersion, moc, uic, rcc, globalAutoGenTarget, - globalAutoRccTarget)); + this, target, qtVersion, mocIsValid, uicIsValid, rccIsValid, + globalAutoGenTarget, globalAutoRccTarget)); } } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 6a2a951..e4d2c82 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -9,6 +9,7 @@ #include "cmCustomCommandLines.h" #include "cmDuration.h" #include "cmFilePathChecksum.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkItem.h" @@ -42,6 +43,9 @@ std::string GetQtExecutableTargetName( const cmQtAutoGen::IntegerVersion& qtVersion, std::string const& executable) { + if (qtVersion.Major == 6) { + return ("Qt6::" + executable); + } if (qtVersion.Major == 5) { return ("Qt5::" + executable); } @@ -395,8 +399,16 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } // Init uic specific settings - if (this->Uic.Enabled && !InitUic()) { - return false; + if (this->Uic.Enabled) { + if (InitUic()) { + auto* uicTarget = makefile->FindTargetToUse( + GetQtExecutableTargetName(this->QtVersion, "uic")); + if (uicTarget != nullptr) { + this->AutogenTarget.DependTargets.insert(uicTarget); + } + } else { + return false; + } } // Autogen target name @@ -437,6 +449,12 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->AutogenTarget.DependOrigin = this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS"); + auto* mocTarget = makefile->FindTargetToUse( + GetQtExecutableTargetName(this->QtVersion, "moc")); + if (mocTarget != nullptr) { + this->AutogenTarget.DependTargets.insert(mocTarget); + } + std::string const deps = this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { @@ -504,7 +522,7 @@ bool cmQtAutoGenInitializer::InitMoc() { // We need to disable this until we have all implicit includes available. // See issue #18669. - // bool const appendImplicit = (this->QtVersion.Major == 5); + // bool const appendImplicit = (this->QtVersion.Major >= 5); auto GetIncludeDirs = [this, localGen](std::string const& cfg) -> std::vector<std::string> { @@ -839,7 +857,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Process qrc files if (!this->Rcc.Qrcs.empty()) { - const bool QtV5 = (this->QtVersion.Major == 5); + const bool modernQt = (this->QtVersion.Major >= 5); // Target rcc options std::vector<std::string> optionsTarget; cmSystemTools::ExpandListArgument( @@ -911,10 +929,10 @@ bool cmQtAutoGenInitializer::InitScanFiles() std::vector<std::string> nameOpts; nameOpts.emplace_back("-name"); nameOpts.emplace_back(std::move(name)); - RccMergeOptions(opts, nameOpts, QtV5); + RccMergeOptions(opts, nameOpts, modernQt); } // Merge file option - RccMergeOptions(opts, qrc.Options, QtV5); + RccMergeOptions(opts, qrc.Options, modernQt); qrc.Options = std::move(opts); } // RCC resources @@ -1092,6 +1110,7 @@ bool cmQtAutoGenInitializer::InitRccTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + auto rccTargetName = GetQtExecutableTargetName(this->QtVersion, "rcc"); for (Qrc const& qrc : this->Rcc.Qrcs) { // Register info file as generated by CMake @@ -1102,6 +1121,11 @@ bool cmQtAutoGenInitializer::InitRccTargets() std::vector<std::string> ccOutput; ccOutput.push_back(qrc.RccFile); + std::vector<std::string> ccDepends; + // Add the .qrc and info file to the custom command dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + cmCustomCommandLines commandLines; if (this->MultiConfig) { // Build for all configurations @@ -1137,15 +1161,12 @@ bool cmQtAutoGenInitializer::InitRccTargets() ccName += "_"; ccName += qrc.PathChecksum; } - std::vector<std::string> ccDepends; - // Add the .qrc and info file to the custom target dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); cmTarget* autoRccTarget = makefile->AddUtilityCommand( ccName, cmMakefile::TargetOrigin::Generator, true, this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false, ccComment.c_str()); + // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autoRccTarget, localGen)); @@ -1154,6 +1175,9 @@ bool cmQtAutoGenInitializer::InitRccTargets() if (!this->TargetsFolder.empty()) { autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str()); } + if (!rccTargetName.empty()) { + autoRccTarget->AddUtility(rccTargetName, makefile); + } } // Add autogen target to the origin target dependencies this->Target->Target->AddUtility(ccName, makefile); @@ -1166,16 +1190,15 @@ bool cmQtAutoGenInitializer::InitRccTargets() // Create custom rcc command { std::vector<std::string> ccByproducts; - std::vector<std::string> ccDepends; - // Add the .qrc and info file to the custom command dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); // Add the resource files to the dependencies for (std::string const& fileName : qrc.Resources) { // Add resource file to the custom command dependencies ccDepends.push_back(fileName); } + if (!rccTargetName.empty()) { + ccDepends.push_back(rccTargetName); + } makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, /*main_dependency*/ std::string(), commandLines, ccComment.c_str(), @@ -1374,7 +1397,7 @@ static std::vector<cmQtAutoGenInitializer::IntegerVersion> GetKnownQtVersions( std::vector<cmQtAutoGenInitializer::IntegerVersion> result; for (const std::string& prefix : - std::vector<std::string>({ "Qt5Core", "QT" })) { + std::vector<std::string>({ "Qt6Core", "Qt5Core", "QT" })) { auto tmp = cmQtAutoGenInitializer::IntegerVersion( StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")), StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR"))); @@ -1418,21 +1441,36 @@ std::pair<bool, std::string> GetQtExecutable( const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target, const std::string& executable, bool ignoreMissingTarget, std::string* output) { + const std::string upperExecutable = cmSystemTools::UpperCase(executable); + std::string result = + target->Target->GetSafeProperty("AUTO" + upperExecutable + "_EXECUTABLE"); + if (!result.empty()) { + cmListFileBacktrace lfbt = target->Target->GetMakefile()->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(result); + result = cge->Evaluate(target->GetLocalGenerator(), ""); + + return std::make_pair(true, result); + } + std::string err; - std::string result; // Find executable { const std::string targetName = GetQtExecutableTargetName(qtVersion, executable); if (targetName.empty()) { - err = "The AUTOMOC, AUTOUIC and AUTORCC feature "; - err += "supports only Qt 4 and Qt 5"; + err = "The AUTO" + upperExecutable + " feature "; + err += "supports only Qt 4, Qt 5 and Qt 6."; } else { cmLocalGenerator* localGen = target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - result = tgt->ImportedGetLocation(""); + if (tgt->IsImported()) { + result = tgt->ImportedGetLocation(""); + } else { + result = tgt->GetLocation(""); + } } else { if (ignoreMissingTarget) { return std::make_pair(true, ""); @@ -1510,7 +1548,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable() return false; } - if (this->QtVersion.Major == 5) { + if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) { if (stdOut.find("--list") != std::string::npos) { this->Rcc.ListOptions.push_back("--list"); } else { diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 7a54e12..d80b5a2 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -328,6 +328,9 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() return false; } + // FIXME: Add a way for caller to specify other versions. + std::wstring wantVersion = std::to_wstring(15) + L'.'; + SmartCOMPtr<ISetupInstance> instance; while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) { SmartCOMPtr<ISetupInstance2> instance2 = NULL; @@ -343,6 +346,12 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() instance = instance2 = NULL; if (isInstalled) { + // We are looking for a specific major version. + if (instanceInfo.Version.size() < wantVersion.size() || + instanceInfo.Version.substr(0, wantVersion.size()) != wantVersion) { + continue; + } + if (!this->SpecifiedVSInstallLocation.empty()) { // We are looking for a specific instance. std::string currentVSLocation = instanceInfo.GetInstallLocation(); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 5d67dcf..afe9230 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -269,7 +269,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() if (keyValue[1].front() == '\'' && keyValue[1].back() == '\'') { keyValue[1] = - keyValue[1].substr(1, std::max<int>(0, keyValue[1].size() - 2)); + keyValue[1].substr(1, std::max(0, cm::isize(keyValue[1]) - 2)); } if (keyValue[0] == "level") { diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index c504ef4..49dbf1a 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -50,7 +50,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { #if defined(_MSC_VER) || defined(__MINGW32__) - writable = mode & S_IWRITE; + writable = (mode & S_IWRITE) != 0; mode_t newMode = mode | S_IWRITE; #else writable = mode & S_IWUSR; diff --git a/Utilities/Sphinx/colors.py b/Utilities/Sphinx/colors.py index f98a483..dae0063 100644 --- a/Utilities/Sphinx/colors.py +++ b/Utilities/Sphinx/colors.py @@ -14,14 +14,14 @@ class CMakeTemplateStyle(Style): styles = { Whitespace: "#bbbbbb", Comment: "italic #408080", - Operator: "bold #000000", + Operator: "#555555", String: "#217A21", Number: "#105030", - Name.Builtin: "#400080", # anything lowercase - Name.Function: "bold #1010A0", # function + Name.Builtin: "#333333", # anything lowercase + Name.Function: "#007020", # function Name.Variable: "#1080B0", # <..> - Name.Tag: "#19177C", # ${..} - Name.Constant: "#6020E0", # uppercase only + Name.Tag: "#bb60d5", # ${..} + Name.Constant: "#4070a0", # uppercase only Name.Entity: "italic #70A020", # @..@ Name.Attribute: "#906060", # paths, URLs Name.Label: "#A0A000", # anything left over |