diff options
Diffstat (limited to 'Source')
70 files changed, 423 insertions, 367 deletions
diff --git a/Source/.gitattributes b/Source/.gitattributes index d0aedc2..4b868dd 100644 --- a/Source/.gitattributes +++ b/Source/.gitattributes @@ -1,4 +1,4 @@ CMakeVersion.cmake export-subst # Do not format third-party sources. -/kwsys/** -format.clang-format-6.0 +/kwsys/** -format.clang-format diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c786604..d7b5ea2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 25) -set(CMake_VERSION_PATCH 20230117) +set(CMake_VERSION_PATCH 20230123) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 9dd8fe3..bc14eb4 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -585,7 +585,7 @@ std::string cmCPackIFWGenerator::GetRootPackageName() // Configure from root group cmCPackIFWPackage package; package.Generator = this; - package.ConfigureFromGroup(optIFW_PACKAGE_GROUP); + package.ConfigureFromGroup(*optIFW_PACKAGE_GROUP); name = package.Name; } else if (cmValue optIFW_PACKAGE_NAME = this->GetOption("CPACK_IFW_PACKAGE_NAME")) { diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 2feca75..69440d9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -77,19 +77,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // ApplicationIcon if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->InstallerApplicationIcon = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", *option); } } // WindowIcon if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->InstallerWindowIcon = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", + *option); } } @@ -104,37 +105,37 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Logo if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Logo = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", *option); } } // Watermark if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Watermark = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", *option); } } // Banner if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Banner = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", *option); } } // Background if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Background = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", *option); } } @@ -155,10 +156,11 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // StyleSheet if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->StyleSheet = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", + *option); } } @@ -276,9 +278,9 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Control script if (cmValue optIFW_CONTROL_SCRIPT = this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) { - if (!cmSystemTools::FileExists(optIFW_CONTROL_SCRIPT)) { + if (!cmSystemTools::FileExists(*optIFW_CONTROL_SCRIPT)) { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_CONTROL_SCRIPT", - optIFW_CONTROL_SCRIPT); + *optIFW_CONTROL_SCRIPT); } else { this->ControlScript = *optIFW_CONTROL_SCRIPT; } @@ -653,9 +655,9 @@ void cmCPackIFWInstaller::GeneratePackageFiles() package.Installer = this; // Check package group if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { - package.ConfigureFromGroup(option); + package.ConfigureFromGroup(*option); std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" + - cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION"; + cmsys::SystemTools::UpperCase(*option) + "_FORCED_INSTALLATION"; if (!this->GetOption(forcedOption)) { package.ForcedInstallation = "true"; } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c2109c9..1668fb5 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -382,7 +382,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->DisplayName.clear(); } else if (cmValue value = this->GetOption(option)) { - cmCPackIFWPackage::ExpandListArgument(value, this->DisplayName); + cmCPackIFWPackage::ExpandListArgument(*value, this->DisplayName); } // Description @@ -390,7 +390,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Description.clear(); } else if (cmValue value = this->GetOption(option)) { - cmCPackIFWPackage::ExpandListArgument(value, this->Description); + cmCPackIFWPackage::ExpandListArgument(*value, this->Description); } // Release date @@ -484,7 +484,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Default.clear(); } else if (cmValue value = this->GetOption(option)) { - std::string lowerValue = cmsys::SystemTools::LowerCase(value); + std::string lowerValue = cmsys::SystemTools::LowerCase(*value); if (lowerValue == "true") { this->Default = "true"; } else if (lowerValue == "false") { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 5dae966..aeb3db3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -422,9 +422,9 @@ void cmCPackWIXGenerator::CopyDefinition(cmWIXSourceWriter& source, cmValue value = GetOption(name); if (value) { if (type == DefinitionType::PATH) { - AddDefinition(source, name, CMakeToWixPath(value)); + AddDefinition(source, name, CMakeToWixPath(*value)); } else { - AddDefinition(source, name, value); + AddDefinition(source, name, *value); } } } @@ -504,7 +504,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() } featureDefinitions.AddAttribute("Title", featureTitle); if (cmValue desc = GetOption("CPACK_WIX_ROOT_FEATURE_DESCRIPTION")) { - featureDefinitions.AddAttribute("Description", desc); + featureDefinitions.AddAttribute("Description", *desc); } featureDefinitions.AddAttribute("Level", "1"); this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions); @@ -512,7 +512,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() cmValue package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); if (package) { featureDefinitions.CreateCMakePackageRegistryEntry( - package, GetOption("CPACK_WIX_UPGRADE_GUID")); + *package, GetOption("CPACK_WIX_UPGRADE_GUID")); } if (!CreateFeatureHierarchy(featureDefinitions)) { diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 894c24b..c9c069c 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -80,10 +80,10 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( *this->GetOption("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME"); } else if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) { packageFileName += this->GetComponentPackageFileName( - this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); + *this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); } else { packageFileName += this->GetComponentPackageFileName( - this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); + *this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); } packageFileName += this->GetOutputExtension(); @@ -357,9 +357,9 @@ int cmCPackArchiveGenerator::GetThreadCount() const // CPACK_ARCHIVE_THREADS overrides CPACK_THREADS if (this->IsSet("CPACK_ARCHIVE_THREADS")) { - threads = std::stoi(this->GetOption("CPACK_ARCHIVE_THREADS")); + threads = std::stoi(*this->GetOption("CPACK_ARCHIVE_THREADS")); } else if (this->IsSet("CPACK_THREADS")) { - threads = std::stoi(this->GetOption("CPACK_THREADS")); + threads = std::stoi(*this->GetOption("CPACK_THREADS")); } return threads; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index a3b9434..6ba28d1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -124,8 +124,8 @@ DebGenerator::DebGenerator( << debianCompressionType << std::endl); } - if (numThreads != nullptr) { - if (!cmStrToLong(numThreads, &this->NumThreads)) { + if (numThreads) { + if (!cmStrToLong(*numThreads, &this->NumThreads)) { this->NumThreads = 1; cmCPackLogger(cmCPackLog::LOG_ERROR, "Unrecognized number of threads: " << numThreads @@ -703,7 +703,7 @@ bool cmCPackDebGenerator::createDebPackages() &cmCPackDebGenerator::createDeb); cmValue dbgsymdir_path = this->GetOption("GEN_DBGSYMDIR"); if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE") && dbgsymdir_path) { - retval = make_package(dbgsymdir_path, "GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME", + retval = make_package(*dbgsymdir_path, "GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME", &cmCPackDebGenerator::createDbgsymDDeb) && retval; } diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index edd8490..4c92592 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -63,7 +63,7 @@ int cmCPackExternalGenerator::PackageFiles() cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT"); if (cmNonempty(packageScript)) { - if (!cmSystemTools::FileIsFullPath(packageScript)) { + if (!cmSystemTools::FileIsFullPath(*packageScript)) { cmCPackLogger( cmCPackLog::LOG_ERROR, "CPACK_EXTERNAL_PACKAGE_SCRIPT does not contain a full file path" @@ -71,7 +71,7 @@ int cmCPackExternalGenerator::PackageFiles() return 0; } - bool res = this->MakefileMap->ReadListFile(packageScript); + bool res = this->MakefileMap->ReadListFile(*packageScript); if (cmSystemTools::GetErrorOccurredFlag() || !res) { return 0; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 90d15f8..2ac5b3d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -91,7 +91,7 @@ int cmCPackGenerator::PrepareNames() "CPACK_PACKAGE_FILE_NAME not specified" << std::endl); return 0; } - std::string outName = pfname; + std::string outName = *pfname; tempDirectory += "/" + outName; if (!this->GetOutputExtension()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -106,7 +106,7 @@ int cmCPackGenerator::PrepareNames() return 0; } - std::string destFile = pdir; + std::string destFile = *pdir; this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile); destFile += "/" + outName; std::string outFile = topDirectory + "/" + outName; @@ -126,17 +126,17 @@ int cmCPackGenerator::PrepareNames() cmValue descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); if (descFileName && !this->GetOption("CPACK_PACKAGE_DESCRIPTION")) { cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Look for: " << descFileName << std::endl); - if (!cmSystemTools::FileExists(descFileName)) { + "Look for: " << *descFileName << std::endl); + if (!cmSystemTools::FileExists(*descFileName)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find description file name: [" - << descFileName << "]" << std::endl); + << *descFileName << "]" << std::endl); return 0; } cmsys::ifstream ifs(descFileName->c_str()); if (!ifs) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot open description file name: " << descFileName + "Cannot open description file name: " << *descFileName << std::endl); return 0; } @@ -144,14 +144,14 @@ int cmCPackGenerator::PrepareNames() std::string line; cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Read description file: " << descFileName << std::endl); + "Read description file: " << *descFileName << std::endl); while (ifs && cmSystemTools::GetLineFromStream(ifs, line)) { ostr << cmXMLSafe(line) << std::endl; } this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str()); cmValue defFileName = this->GetOption("CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE"); - if (defFileName && (defFileName == descFileName)) { + if (defFileName && (*defFileName == *descFileName)) { this->SetOption("CPACK_USED_DEFAULT_PACKAGE_DESCRIPTION_FILE", "ON"); } } @@ -636,7 +636,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::unique_ptr<cmGlobalGenerator> globalGenerator = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( - cmakeGenerator); + *cmakeGenerator); if (!globalGenerator) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Specified package generator not found. " @@ -1050,14 +1050,14 @@ int cmCPackGenerator::DoPackage() if (cmIsOn(this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY"))) { cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - if (cmSystemTools::FileExists(toplevelDirectory)) { + if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Remove toplevel directory: " << toplevelDirectory + "Remove toplevel directory: " << *toplevelDirectory << std::endl); - if (!cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory)) { + if (!cmSystemTools::RepeatedRemoveDirectory(*toplevelDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing toplevel directory: " - << toplevelDirectory << std::endl); + << *toplevelDirectory << std::endl); return 0; } } @@ -1091,10 +1091,10 @@ int cmCPackGenerator::DoPackage() "Package files to: " << (tempPackageFileName ? *tempPackageFileName : "(NULL)") << std::endl); - if (cmSystemTools::FileExists(tempPackageFileName)) { + if (tempPackageFileName && cmSystemTools::FileExists(*tempPackageFileName)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove old package file" << std::endl); - cmSystemTools::RemoveFile(tempPackageFileName); + cmSystemTools::RemoveFile(*tempPackageFileName); } if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) { tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -1211,7 +1211,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) // Load the project specific config file cmValue config = this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if (config) { - mf->ReadListFile(config); + mf->ReadListFile(*config); } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccurredFlag()) { @@ -1581,7 +1581,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent( cmValue groupName = this->GetOption(macroPrefix + "_GROUP"); if (cmNonempty(groupName)) { - component->Group = this->GetComponentGroup(projectName, groupName); + component->Group = this->GetComponentGroup(projectName, *groupName); component->Group->Components.push_back(component); } else { component->Group = nullptr; @@ -1644,7 +1644,7 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup( cmValue parentGroupName = this->GetOption(macroPrefix + "_PARENT_GROUP"); if (cmNonempty(parentGroupName)) { group->ParentGroup = - this->GetComponentGroup(projectName, parentGroupName); + this->GetComponentGroup(projectName, *parentGroupName); group->ParentGroup->Subgroups.push_back(group); } else { group->ParentGroup = nullptr; diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 65156ab..8078d9f 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -344,8 +344,14 @@ private: #define cmCPackTypeMacro(klass, superclass) \ using Superclass = superclass; \ - const char* GetNameOfClass() override { return #klass; } \ - static cmCPackGenerator* CreateGenerator() { return new klass; } \ + const char* GetNameOfClass() override \ + { \ + return #klass; \ + } \ + static cmCPackGenerator* CreateGenerator() \ + { \ + return new klass; \ + } \ class cmCPackTypeMacro_UseTrailingSemicolon #define cmCPackLogger(logType, msg) \ diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6ca5783..d7119c5 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -473,7 +473,7 @@ int cmCPackNSISGenerator::InitializeInternal() this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis"); nsisPath = cmSystemTools::FindProgram( - this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false); + *this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false); if (nsisPath.empty()) { cmCPackLogger( diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 7b9f6cf..76ef091 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -58,16 +58,17 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, ? cmStrCat("CPACK_", genName, "_BACKGROUND") : cmStrCat("CPACK_", genName, "_BACKGROUND_", paramSuffix); cmValue bgFileName = this->GetOption(opt); - if (bgFileName == nullptr) { + if (!bgFileName) { return; } - std::string bgFilePath = cmStrCat(metapackageFile, "/Contents/", bgFileName); + std::string bgFilePath = + cmStrCat(metapackageFile, "/Contents/", *bgFileName); if (!cmSystemTools::FileExists(bgFilePath)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Background image doesn't exist in the resource directory: " - << bgFileName << std::endl); + << *bgFileName << std::endl); return; } @@ -77,16 +78,16 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, xout.StartElement(cmStrCat("background-", themeName)); } - xout.Attribute("file", bgFileName); + xout.Attribute("file", *bgFileName); cmValue param = this->GetOption(cmStrCat(opt, "_ALIGNMENT")); if (param != nullptr) { - xout.Attribute("alignment", param); + xout.Attribute("alignment", *param); } param = this->GetOption(cmStrCat(opt, "_SCALING")); if (param != nullptr) { - xout.Attribute("scaling", param); + xout.Attribute("scaling", *param); } // Apple docs say that you must provide either mime-type or uti @@ -94,12 +95,12 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, // doesn't have them, so don't make them mandatory. param = this->GetOption(cmStrCat(opt, "_MIME_TYPE")); if (param != nullptr) { - xout.Attribute("mime-type", param); + xout.Attribute("mime-type", *param); } param = this->GetOption(cmStrCat(opt, "_UTI")); if (param != nullptr) { - xout.Attribute("uti", param); + xout.Attribute("uti", *param); } xout.EndElement(); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c228f07..2257118 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -233,9 +233,6 @@ int main(int argc, char const* const* argv) cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator cmgg(&cminst); cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot()); -#if defined(__CYGWIN__) - globalMF.AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); -#endif bool parsed = true; for (std::size_t i = 0; i < inputArgs.size(); i++) { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 66c30c0..c6387ab 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -671,10 +671,10 @@ bool cmCTestBuildHandler::IsLaunchedWarningFile(const char* fname) cmHasLiteralSuffix(fname, ".xml")); } -//###################################################################### -//###################################################################### -//###################################################################### -//###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### class cmCTestBuildHandler::LaunchHelper { @@ -963,10 +963,10 @@ int cmCTestBuildHandler::RunMakeCommand(const std::string& command, return result; } -//###################################################################### -//###################################################################### -//###################################################################### -//###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, size_t& tick, size_t tick_len, diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 5a66f82..ee06b29 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -326,10 +326,6 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg); } -#if defined(__CYGWIN__) - this->Makefile->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); -#endif - // set a callback function to update the elapsed time this->Makefile->OnExecuteCommand([this] { this->UpdateElapsedTime(); }); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index da085a6..2bc270e 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -718,7 +718,7 @@ int cmCTestSubmitHandler::ProcessHandler() cmValue cdashUploadFile = this->GetOption("CDashUploadFile"); cmValue cdashUploadType = this->GetOption("CDashUploadType"); if (cdashUploadFile && cdashUploadType) { - return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType); + return this->HandleCDashUploadFile(*cdashUploadFile, *cdashUploadType); } const std::string& buildDirectory = diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index daaf5fd..1c8c713 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -363,10 +363,10 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf) cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION"); if (dval) { - if (!this->SetTestOutputTruncation(dval)) { + if (!this->SetTestOutputTruncation(*dval)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: " - << dval << std::endl); + << *dval << std::endl); } } } @@ -520,7 +520,7 @@ bool cmCTestTestHandler::ProcessOptions() if (cmValue repeat = this->GetOption("Repeat")) { cmsys::RegularExpression repeatRegex( "^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$"); - if (repeatRegex.find(repeat)) { + if (repeatRegex.find(*repeat)) { std::string const& count = repeatRegex.match(2); unsigned long n = 1; cmStrToULong(count, &n); // regex guarantees success @@ -537,12 +537,13 @@ bool cmCTestTestHandler::ProcessOptions() } } else { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Repeat option invalid value: " << repeat << std::endl); + "Repeat option invalid value: " << *repeat << std::endl); return false; } } if (this->GetOption("ParallelLevel")) { - this->CTest->SetParallelLevel(std::stoi(this->GetOption("ParallelLevel"))); + this->CTest->SetParallelLevel( + std::stoi(*this->GetOption("ParallelLevel"))); } if (this->GetOption("StopOnFailure")) { @@ -556,12 +557,12 @@ bool cmCTestTestHandler::ProcessOptions() cmValue val = this->GetOption("IncludeRegularExpression"); if (val) { this->UseIncludeRegExp(); - this->SetIncludeRegExp(val); + this->SetIncludeRegExp(*val); } val = this->GetOption("ExcludeRegularExpression"); if (val) { this->UseExcludeRegExp(); - this->SetExcludeRegExp(val); + this->SetExcludeRegExp(*val); } val = this->GetOption("ExcludeFixtureRegularExpression"); if (val) { @@ -2110,9 +2111,9 @@ void cmCTestTestHandler::SetTestsToRunInformation(cmValue in) this->TestsToRunString = *in; // if the argument is a file, then read it and use the contents as the // string - if (cmSystemTools::FileExists(in)) { + if (cmSystemTools::FileExists(*in)) { cmsys::ifstream fin(in->c_str()); - unsigned long filelen = cmSystemTools::FileLength(in); + unsigned long filelen = cmSystemTools::FileLength(*in); auto buff = cm::make_unique<char[]>(filelen + 1); fin.getline(buff.get(), filelen); buff[fin.gcount()] = 0; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index d448c76..045eb84 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -123,7 +123,7 @@ int cmCTestUpdateHandler::ProcessHandler() } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Updating the repository: " << sourceDirectory + " Updating the repository: " << *sourceDirectory << std::endl, this->Quiet); @@ -163,7 +163,7 @@ int cmCTestUpdateHandler::ProcessHandler() break; } vc->SetCommandLineTool(this->UpdateCommand); - vc->SetSourceDirectory(sourceDirectory); + vc->SetSourceDirectory(*sourceDirectory); // Cleanup the working tree. vc->Cleanup(); diff --git a/Source/CursesDialog/form/.gitattributes b/Source/CursesDialog/form/.gitattributes index 6dfa627..6e255e4 100644 --- a/Source/CursesDialog/form/.gitattributes +++ b/Source/CursesDialog/form/.gitattributes @@ -1,2 +1,2 @@ * -whitespace -* -format.clang-format-6.0 +* -format.clang-format diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index f29983c..e992b4b 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -68,7 +68,7 @@ public: ~Entry() { archive_entry_free(this->Object); } Entry(const Entry&) = delete; Entry& operator=(const Entry&) = delete; - operator struct archive_entry*() { return this->Object; } + operator struct archive_entry *() { return this->Object; } }; struct cmArchiveWrite::Callback diff --git a/Source/cmCPluginAPI.h b/Source/cmCPluginAPI.h index 0d8a366..13a93b7 100644 --- a/Source/cmCPluginAPI.h +++ b/Source/cmCPluginAPI.h @@ -201,7 +201,7 @@ typedef const char*(CCONV* CM_DOC_FUNCTION)(); /* NOLINTNEXTLINE(modernize-use-using) */ typedef int(CCONV* CM_INITIAL_PASS_FUNCTION)(void* info, void* mf, int argc, - char* []); + char*[]); /* NOLINTNEXTLINE(modernize-use-using) */ typedef void(CCONV* CM_FINAL_PASS_FUNCTION)(void* info, void* mf); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 72cd8cd..5899a61 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1066,10 +1066,10 @@ int cmCTest::GetTestModelFromString(const std::string& str) return cmCTest::EXPERIMENTAL; } -//###################################################################### -//###################################################################### -//###################################################################### -//###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### int cmCTest::RunMakeCommand(const std::string& command, std::string& output, int* retVal, const char* dir, cmDuration timeout, @@ -1185,10 +1185,10 @@ int cmCTest::RunMakeCommand(const std::string& command, std::string& output, return result; } -//###################################################################### -//###################################################################### -//###################################################################### -//###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### +// ###################################################################### int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, int* retVal, std::ostream* log, cmDuration testTimeOut, diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 8cbdcaa..8e05fac 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -260,8 +260,8 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr }; auto overrideFeature = cmGeneratorExpression::Evaluate( - feature, this->Target->GetLocalGenerator(), config, this->Target, - &dag, this->Target, linkLanguage); + *feature, this->Target->GetLocalGenerator(), config, + this->Target, &dag, this->Target, linkLanguage); this->LinkLibraryOverride.emplace(item, overrideFeature); } } @@ -274,7 +274,7 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr }; auto overrideValue = cmGeneratorExpression::Evaluate( - linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag, + *linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag, target, linkLanguage); auto overrideList = cmTokenize(overrideValue, ","_s); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6cfdf62..ad8fb8b 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -30,7 +30,7 @@ #include "cmValue.h" #include "cmake.h" -//#define CM_COMPUTE_LINK_INFO_DEBUG +// #define CM_COMPUTE_LINK_INFO_DEBUG /* Notes about linking on various platforms: @@ -366,7 +366,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( this->LibraryFeatureDescriptors.emplace( "__CMAKE_LINK_EXECUTABLE", LibraryFeatureDescriptor{ "__CMAKE_LINK_EXECUTABLE", - cmStrCat(this->LoaderFlag, "<LIBRARY>") }); + cmStrCat(*this->LoaderFlag, "<LIBRARY>") }); } // To link framework using a full path this->LibraryFeatureDescriptors.emplace( @@ -858,8 +858,8 @@ bool cmComputeLinkInformation::AddLibraryFeature(std::string const& feature) return false; } - auto items = - cmExpandListWithBacktrace(langFeature, this->Target->GetBacktrace(), true); + auto items = cmExpandListWithBacktrace(*langFeature, + this->Target->GetBacktrace(), true); if ((items.size() == 1 && !IsValidFeatureFormat(items.front().Value)) || (items.size() == 3 && !IsValidFeatureFormat(items[1].Value))) { @@ -1016,8 +1016,8 @@ cmComputeLinkInformation::GetGroupFeature(std::string const& feature) .first->second; } - auto items = - cmExpandListWithBacktrace(langFeature, this->Target->GetBacktrace(), true); + auto items = cmExpandListWithBacktrace(*langFeature, + this->Target->GetBacktrace(), true); // replace LINKER: pattern this->Target->ResolveLinkerWrapper(items, this->LinkLanguage, true); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 2084b33..618c794 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -39,12 +39,14 @@ constexpr size_t lang_property_start = 0; constexpr size_t lang_property_size = 4; constexpr size_t pie_property_start = 4; constexpr size_t pie_property_size = 2; +/* clang-format off */ #define SETUP_LANGUAGE(name, lang) \ static const std::string name[lang_property_size + pie_property_size + 1] = \ { "CMAKE_" #lang "_COMPILER_EXTERNAL_TOOLCHAIN", \ "CMAKE_" #lang "_COMPILER_TARGET", \ "CMAKE_" #lang "_LINK_NO_PIE_SUPPORTED", \ "CMAKE_" #lang "_PIE_SUPPORTED", "" } +/* clang-format on */ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma) SETUP_LANGUAGE(c_properties, C); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index ba4b326..a07acdc 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -67,7 +67,7 @@ cmExtraEclipseCDT4Generator::GetFactory() if (factory.GetSupportedGlobalGenerators().empty()) { // TODO: Verify if __CYGWIN__ should be checked. -//#if defined(_WIN32) && !defined(__CYGWIN__) +// #if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) factory.AddSupportedGlobalGenerator("NMake Makefiles"); factory.AddSupportedGlobalGenerator("MinGW Makefiles"); diff --git a/Source/cmFileAPIConfigureLog.cxx b/Source/cmFileAPIConfigureLog.cxx index 50189cb..ad0997c 100644 --- a/Source/cmFileAPIConfigureLog.cxx +++ b/Source/cmFileAPIConfigureLog.cxx @@ -52,6 +52,7 @@ Json::Value ConfigureLog::DumpEventKindNames() // major version of the configureLog object kind is needed. Json::Value eventKindNames = Json::arrayValue; if (this->Version == 1) { + eventKindNames.append("message-v1"); // WriteMessageEvent eventKindNames.append("try_compile-v1"); // WriteTryCompileEvent eventKindNames.append("try_run-v1"); // WriteTryRunEvent } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index b8d345f..4df81d5 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -344,7 +344,7 @@ struct entry_to_remove { if (cmValue to_skip = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_COUNT"))) { - cmStrToLong(to_skip, &count); + cmStrToLong(*to_skip, &count); } if (cmValue prefix_value = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_VALUE"))) { diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 71c7e13..c1b82ab 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -2204,7 +2204,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable() std::string install_path_to_remove; if (cmValue to_skip = this->Makefile->GetDefinition( "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT")) { - cmStrToLong(to_skip, &install_prefix_count); + cmStrToLong(*to_skip, &install_prefix_count); } if (cmValue install_value = this->Makefile->GetDefinition( "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE")) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d0d339d..30aa99b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -572,12 +572,7 @@ std::string cmGeneratorTarget::GetFilePrefix( cmValue prefix = this->GetFilePrefixInternal(config, artifact); return prefix ? *prefix : std::string(); } - - std::string prefix; - std::string suffix; - std::string base; - this->GetFullNameInternal(config, artifact, prefix, base, suffix); - return prefix; + return this->GetFullNameInternalComponents(config, artifact).prefix; } std::string cmGeneratorTarget::GetFileSuffix( const std::string& config, cmStateEnums::ArtifactType artifact) const @@ -586,12 +581,7 @@ std::string cmGeneratorTarget::GetFileSuffix( cmValue suffix = this->GetFileSuffixInternal(config, artifact); return suffix ? *suffix : std::string(); } - - std::string prefix; - std::string suffix; - std::string base; - this->GetFullNameInternal(config, artifact, prefix, base, suffix); - return suffix; + return this->GetFullNameInternalComponents(config, artifact).suffix; } std::string cmGeneratorTarget::GetFilePostfix(const std::string& config) const @@ -755,6 +745,8 @@ void cmGeneratorTarget::ClearSourcesCache() this->PrecompileHeadersCache.clear(); this->LinkOptionsCache.clear(); this->LinkDirectoriesCache.clear(); + this->RuntimeBinaryFullNameCache.clear(); + this->ImportLibraryFullNameCache.clear(); } void cmGeneratorTarget::ClearLinkInterfaceCache() @@ -2180,23 +2172,21 @@ std::set<std::string> cmGeneratorTarget::GetAllConfigCompileLanguages() const std::string cmGeneratorTarget::GetCompilePDBName( const std::string& config) const { - std::string prefix; - std::string base; - std::string suffix; - this->GetFullNameInternal(config, cmStateEnums::RuntimeBinaryArtifact, - prefix, base, suffix); - // Check for a per-configuration output directory target property. std::string configUpper = cmSystemTools::UpperCase(config); std::string configProp = cmStrCat("COMPILE_PDB_NAME_", configUpper); cmValue config_name = this->GetProperty(configProp); if (cmNonempty(config_name)) { - return prefix + *config_name + ".pdb"; + NameComponents const& components = GetFullNameInternalComponents( + config, cmStateEnums::RuntimeBinaryArtifact); + return components.prefix + *config_name + ".pdb"; } cmValue name = this->GetProperty("COMPILE_PDB_NAME"); if (cmNonempty(name)) { - return prefix + *name + ".pdb"; + NameComponents const& components = GetFullNameInternalComponents( + config, cmStateEnums::RuntimeBinaryArtifact); + return components.prefix + *name + ".pdb"; } return ""; @@ -2939,11 +2929,11 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config, } } -void cmGeneratorTarget::GetFullNameComponents( - std::string& prefix, std::string& base, std::string& suffix, - const std::string& config, cmStateEnums::ArtifactType artifact) const +cmGeneratorTarget::NameComponents const& +cmGeneratorTarget::GetFullNameComponents( + std::string const& config, cmStateEnums::ArtifactType artifact) const { - this->GetFullNameInternal(config, artifact, prefix, base, suffix); + return this->GetFullNameInternalComponents(config, artifact); } std::string cmGeneratorTarget::BuildBundleDirectory( @@ -3572,7 +3562,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, if (ipoEnabled && compileOrLink == cmBuildStep::Link) { if (cmValue cudaIPOFlags = this->Makefile->GetDefinition("CMAKE_CUDA_LINK_OPTIONS_IPO")) { - flags += cudaIPOFlags; + flags += *cudaIPOFlags; } } @@ -5261,32 +5251,33 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames( } // Get the components of the library name. - std::string prefix; - std::string suffix; - this->GetFullNameInternal(config, cmStateEnums::RuntimeBinaryArtifact, - prefix, targetNames.Base, suffix); + NameComponents const& components = this->GetFullNameInternalComponents( + config, cmStateEnums::RuntimeBinaryArtifact); // The library name. - targetNames.Output = prefix + targetNames.Base + suffix; + targetNames.Base = components.base; + targetNames.Output = + components.prefix + targetNames.Base + components.suffix; if (this->IsFrameworkOnApple()) { - targetNames.Real = prefix; + targetNames.Real = components.prefix; if (!this->Makefile->PlatformIsAppleEmbedded()) { targetNames.Real += "Versions/"; targetNames.Real += this->GetFrameworkVersion(); targetNames.Real += "/"; } - targetNames.Real += targetNames.Base + suffix; - targetNames.SharedObject = targetNames.Real + suffix; + targetNames.Real += targetNames.Base + components.suffix; + targetNames.SharedObject = targetNames.Real + components.suffix; } else { // The library's soname. - this->ComputeVersionedName(targetNames.SharedObject, prefix, - targetNames.Base, suffix, targetNames.Output, - soversion); + this->ComputeVersionedName(targetNames.SharedObject, components.prefix, + targetNames.Base, components.suffix, + targetNames.Output, soversion); // The library's real name on disk. - this->ComputeVersionedName(targetNames.Real, prefix, targetNames.Base, - suffix, targetNames.Output, version); + this->ComputeVersionedName(targetNames.Real, components.prefix, + targetNames.Base, components.suffix, + targetNames.Output, version); } // The import library name. @@ -5330,17 +5321,17 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames( #endif // Get the components of the executable name. - std::string prefix; - std::string suffix; - this->GetFullNameInternal(config, cmStateEnums::RuntimeBinaryArtifact, - prefix, targetNames.Base, suffix); + NameComponents const& components = this->GetFullNameInternalComponents( + config, cmStateEnums::RuntimeBinaryArtifact); // The executable name. - targetNames.Output = prefix + targetNames.Base + suffix; + targetNames.Base = components.base; + targetNames.Output = + components.prefix + targetNames.Base + components.suffix; // The executable's real name on disk. #if defined(__CYGWIN__) - targetNames.Real = prefix + targetNames.Base; + targetNames.Real = components.prefix + targetNames.Base; #else targetNames.Real = targetNames.Output; #endif @@ -5349,7 +5340,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames( targetNames.Real += *version; } #if defined(__CYGWIN__) - targetNames.Real += suffix; + targetNames.Real += components.suffix; #endif // The import library name. @@ -5365,11 +5356,9 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames( std::string cmGeneratorTarget::GetFullNameInternal( const std::string& config, cmStateEnums::ArtifactType artifact) const { - std::string prefix; - std::string base; - std::string suffix; - this->GetFullNameInternal(config, artifact, prefix, base, suffix); - return prefix + base + suffix; + NameComponents const& components = + this->GetFullNameInternalComponents(config, artifact); + return components.prefix + components.base + components.suffix; } std::string cmGeneratorTarget::ImportedGetLocation( @@ -5387,19 +5376,27 @@ std::string cmGeneratorTarget::GetFullNameImported( this->Target->ImportedGetFullPath(config, artifact)); } -void cmGeneratorTarget::GetFullNameInternal( - const std::string& config, cmStateEnums::ArtifactType artifact, - std::string& outPrefix, std::string& outBase, std::string& outSuffix) const +cmGeneratorTarget::NameComponents const& +cmGeneratorTarget::GetFullNameInternalComponents( + std::string const& config, cmStateEnums::ArtifactType artifact) const { + assert(artifact == cmStateEnums::RuntimeBinaryArtifact || + artifact == cmStateEnums::ImportLibraryArtifact); + FullNameCache& cache = artifact == cmStateEnums::RuntimeBinaryArtifact + ? RuntimeBinaryFullNameCache + : ImportLibraryFullNameCache; + auto search = cache.find(config); + if (search != cache.end()) { + return search->second; + } // Use just the target name for non-main target types. if (this->GetType() != cmStateEnums::STATIC_LIBRARY && this->GetType() != cmStateEnums::SHARED_LIBRARY && this->GetType() != cmStateEnums::MODULE_LIBRARY && this->GetType() != cmStateEnums::EXECUTABLE) { - outPrefix.clear(); - outBase = this->GetName(); - outSuffix.clear(); - return; + NameComponents components; + components.base = this->GetName(); + return cache.emplace(config, std::move(components)).first->second; } const bool isImportedLibraryArtifact = @@ -5408,12 +5405,14 @@ void cmGeneratorTarget::GetFullNameInternal( // Return an empty name for the import library if this platform // does not support import libraries. if (isImportedLibraryArtifact && !this->NeedImportLibraryName(config)) { - outPrefix.clear(); - outBase.clear(); - outSuffix.clear(); - return; + return cache.emplace(config, NameComponents()).first->second; } + NameComponents parts; + std::string& outPrefix = parts.prefix; + std::string& outBase = parts.base; + std::string& outSuffix = parts.suffix; + // retrieve prefix and suffix std::string ll = this->GetLinkerLanguage(config); cmValue targetPrefix = this->GetFilePrefixInternal(config, artifact, ll); @@ -5474,6 +5473,8 @@ void cmGeneratorTarget::GetFullNameInternal( // Append the suffix. outSuffix = targetSuffix ? *targetSuffix : ""; + + return cache.emplace(config, std::move(parts)).first->second; } std::string cmGeneratorTarget::GetLinkerLanguage( @@ -5509,11 +5510,8 @@ std::string cmGeneratorTarget::GetPDBOutputName( std::string cmGeneratorTarget::GetPDBName(const std::string& config) const { - std::string prefix; - std::string base; - std::string suffix; - this->GetFullNameInternal(config, cmStateEnums::RuntimeBinaryArtifact, - prefix, base, suffix); + NameComponents const& parts = this->GetFullNameInternalComponents( + config, cmStateEnums::RuntimeBinaryArtifact); std::vector<std::string> props; std::string configUpper = cmSystemTools::UpperCase(config); @@ -5527,11 +5525,10 @@ std::string cmGeneratorTarget::GetPDBName(const std::string& config) const for (std::string const& p : props) { if (cmValue outName = this->GetProperty(p)) { - base = *outName; - break; + return parts.prefix + *outName + ".pdb"; } } - return prefix + base + ".pdb"; + return parts.prefix + parts.base + ".pdb"; } std::string cmGeneratorTarget::GetObjectDirectory( @@ -5987,7 +5984,7 @@ std::string valueAsString<std::string>(std::string value) template <> std::string valueAsString<cmValue>(cmValue value) { - return value ? value : std::string("(unset)"); + return value ? *value : std::string("(unset)"); } template <> std::string valueAsString<std::nullptr_t>(std::nullptr_t /*unused*/) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 7fa662d..dd10c64 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -348,10 +348,16 @@ public: /** Get the soname of the target. Allowed only for a shared library. */ std::string GetSOName(const std::string& config) const; - void GetFullNameComponents(std::string& prefix, std::string& base, - std::string& suffix, const std::string& config, - cmStateEnums::ArtifactType artifact = - cmStateEnums::RuntimeBinaryArtifact) const; + struct NameComponents + { + std::string prefix; + std::string base; + std::string suffix; + }; + NameComponents const& GetFullNameComponents( + std::string const& config, + cmStateEnums::ArtifactType artifact = + cmStateEnums::RuntimeBinaryArtifact) const; /** Append to @a base the bundle directory hierarchy up to a certain @a level * and return it. */ @@ -940,10 +946,14 @@ private: std::string GetFullNameInternal(const std::string& config, cmStateEnums::ArtifactType artifact) const; - void GetFullNameInternal(const std::string& config, - cmStateEnums::ArtifactType artifact, - std::string& outPrefix, std::string& outBase, - std::string& outSuffix) const; + + using FullNameCache = std::map<std::string, NameComponents>; + + mutable FullNameCache RuntimeBinaryFullNameCache; + mutable FullNameCache ImportLibraryFullNameCache; + + NameComponents const& GetFullNameInternalComponents( + std::string const& config, cmStateEnums::ArtifactType artifact) const; mutable std::string LinkerLanguage; using LinkClosureMapType = std::map<std::string, LinkClosure>; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8ca6ee6..4cfec22 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -4,11 +4,13 @@ #include <algorithm> #include <cassert> +#include <chrono> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <initializer_list> +#include <iomanip> #include <iterator> #include <sstream> #include <utility> @@ -947,7 +949,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, // Subclasses override this method if they do not support this advice. os << "Tell CMake where to find the compiler by setting "; if (envVar) { - os << "either the environment variable \"" << envVar << "\" or "; + os << "either the environment variable \"" << *envVar << "\" or "; } os << "the CMake cache entry CMAKE_" << lang << "_COMPILER " @@ -1303,6 +1305,8 @@ void cmGlobalGenerator::CreateLocalGenerators() void cmGlobalGenerator::Configure() { + auto startTime = std::chrono::steady_clock::now(); + this->FirstTimeProgress = 0.0f; this->ClearGeneratorMembers(); this->NextDeferId = 0; @@ -1350,20 +1354,17 @@ void cmGlobalGenerator::Configure() "number of local generators", cmStateEnums::INTERNAL); + auto endTime = std::chrono::steady_clock::now(); + if (this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE) { std::ostringstream msg; if (cmSystemTools::GetErrorOccurredFlag()) { msg << "Configuring incomplete, errors occurred!"; - const char* logs[] = { "CMakeOutput.log", "CMakeError.log", nullptr }; - for (const char** log = logs; *log; ++log) { - std::string f = cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(), - "/CMakeFiles/", *log); - if (cmSystemTools::FileExists(f)) { - msg << "\nSee also \"" << f << "\"."; - } - } } else { - msg << "Configuring done"; + auto ms = std::chrono::duration_cast<std::chrono::milliseconds>( + endTime - startTime); + msg << "Configuring done (" << std::fixed << std::setprecision(1) + << ms.count() / 1000.0L << "s)"; } this->CMakeInstance->UpdateProgress(msg.str(), -1); } @@ -1606,6 +1607,8 @@ bool cmGlobalGenerator::Compute() void cmGlobalGenerator::Generate() { + auto startTime = std::chrono::steady_clock::now(); + // Create a map from local generator to the complete set of targets // it builds by default. this->InitializeProgressMarks(); @@ -1688,7 +1691,13 @@ void cmGlobalGenerator::Generate() w.str()); } - this->CMakeInstance->UpdateProgress("Generating done", -1); + auto endTime = std::chrono::steady_clock::now(); + auto ms = + std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime); + std::ostringstream msg; + msg << "Generating done (" << std::fixed << std::setprecision(1) + << ms.count() / 1000.0L << "s)"; + this->CMakeInstance->UpdateProgress(msg.str(), -1); } bool cmGlobalGenerator::ComputeTargetDepends() @@ -2040,7 +2049,7 @@ int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir, cmBuildOptions defaultBuildOptions(false, fast, PackageResolveMode::Disable); return this->Build(jobs, srcdir, bindir, projectName, newTarget, output, "", - config, defaultBuildOptions, false, + config, defaultBuildOptions, true, this->TryCompileTimeout); } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 18c48d7..3da15f6 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -100,10 +100,10 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, cmValue prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); /* check if the toolset changed from last generate */ - if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, prevTool)) { + if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, *prevTool)) { std::string const& e = cmStrCat("toolset build tool: ", gbuild, - "\nDoes not match the previously used build tool: ", prevTool, + "\nDoes not match the previously used build tool: ", *prevTool, "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."); mf->IssueMessage(MessageType::FATAL_ERROR, e); @@ -354,7 +354,7 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( * unsupported target type and should be skipped. */ if (projFile && projType) { - std::string path = cmSystemTools::RelativePath(rootBinaryDir, projFile); + std::string path = cmSystemTools::RelativePath(rootBinaryDir, *projFile); fout << path; fout << ' ' << *projType << '\n'; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index c24b1e3..a1eadb9 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -8,6 +8,7 @@ #include <cstdio> #include <functional> #include <sstream> +#include <tuple> #include <utility> #include <cm/iterator> @@ -584,7 +585,7 @@ void cmGlobalNinjaGenerator::Generate() } for (auto& it : this->Configs) { - it.second.TargetDependsClosures.clear(); + it.second.TargetDependsClosureLocalOutputs.clear(); } this->InitOutputPathPrefix(); @@ -1360,70 +1361,85 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( cmGeneratorTarget const* target, cmNinjaDeps& outputs, const std::string& config, const std::string& fileConfig, bool genexOutput) { - cmNinjaOuts outs; - this->AppendTargetDependsClosure(target, outs, config, fileConfig, - genexOutput, true); - cm::append(outputs, outs); -} + struct Entry + { + Entry(cmGeneratorTarget const* target_, std::string config_, + std::string fileConfig_) + : target(target_) + , config(std::move(config_)) + , fileConfig(std::move(fileConfig_)) + { + } -void cmGlobalNinjaGenerator::AppendTargetDependsClosure( - cmGeneratorTarget const* target, cmNinjaOuts& outputs, - const std::string& config, const std::string& fileConfig, bool genexOutput, - bool omit_self) -{ + bool operator<(Entry const& other) const + { + return std::tie(target, config, fileConfig) < + std::tie(other.target, other.config, other.fileConfig); + } - // try to locate the target in the cache - ByConfig::TargetDependsClosureKey key{ - target, - config, - genexOutput, + cmGeneratorTarget const* target; + std::string config; + std::string fileConfig; }; - auto find = this->Configs[fileConfig].TargetDependsClosures.lower_bound(key); - - if (find == this->Configs[fileConfig].TargetDependsClosures.end() || - find->first != key) { - // We now calculate the closure outputs by inspecting the dependent - // targets recursively. - // For that we have to distinguish between a local result set that is only - // relevant for filling the cache entries properly isolated and a global - // result set that is relevant for the result of the top level call to - // AppendTargetDependsClosure. - cmNinjaOuts this_outs; // this will be the new cache entry - - for (auto const& dep_target : this->GetTargetDirectDepends(target)) { + + cmNinjaOuts outputSet; + std::vector<Entry> stack; + stack.emplace_back(target, config, fileConfig); + std::set<Entry> seen = { stack.back() }; + + do { + Entry entry = std::move(stack.back()); + stack.pop_back(); + + // generate the outputs of the target itself, if applicable + if (entry.target != target) { + // try to locate the target in the cache + ByConfig::TargetDependsClosureKey localCacheKey{ + entry.target, + entry.config, + genexOutput, + }; + auto& configs = this->Configs[entry.fileConfig]; + auto lb = + configs.TargetDependsClosureLocalOutputs.lower_bound(localCacheKey); + + if (lb == configs.TargetDependsClosureLocalOutputs.end() || + lb->first != localCacheKey) { + cmNinjaDeps outs; + this->AppendTargetOutputs(entry.target, outs, entry.config, + DependOnTargetArtifact); + configs.TargetDependsClosureLocalOutputs.emplace_hint( + lb, localCacheKey, outs); + for (auto& value : outs) { + outputSet.emplace(std::move(value)); + } + } else { + outputSet.insert(lb->second.begin(), lb->second.end()); + } + } + + // push next dependencies + for (const auto& dep_target : this->GetTargetDirectDepends(entry.target)) { if (!dep_target->IsInBuildSystem()) { continue; } - if (!this->IsSingleConfigUtility(target) && + if (!this->IsSingleConfigUtility(entry.target) && !this->IsSingleConfigUtility(dep_target) && this->EnableCrossConfigBuild() && !dep_target.IsCross() && !genexOutput) { continue; } - if (dep_target.IsCross()) { - this->AppendTargetDependsClosure(dep_target, this_outs, fileConfig, - fileConfig, genexOutput, false); - } else { - this->AppendTargetDependsClosure(dep_target, this_outs, config, - fileConfig, genexOutput, false); + auto emplaceRes = seen.emplace( + dep_target, dep_target.IsCross() ? entry.fileConfig : entry.config, + entry.fileConfig); + if (emplaceRes.second) { + stack.emplace_back(*emplaceRes.first); } } - find = this->Configs[fileConfig].TargetDependsClosures.emplace_hint( - find, key, std::move(this_outs)); - } - - // now fill the outputs of the final result from the newly generated cache - // entry - outputs.insert(find->second.begin(), find->second.end()); - - // finally generate the outputs of the target itself, if applicable - cmNinjaDeps outs; - if (!omit_self) { - this->AppendTargetOutputs(target, outs, config, DependOnTargetArtifact); - } - outputs.insert(outs.begin(), outs.end()); + } while (!stack.empty()); + cm::append(outputs, outputSet); } void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 775e792..2b6d1cd 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -354,11 +354,6 @@ public: const std::string& config, const std::string& fileConfig, bool genexOutput); - void AppendTargetDependsClosure(cmGeneratorTarget const* target, - cmNinjaOuts& outputs, - const std::string& config, - const std::string& fileConfig, - bool genexOutput, bool omit_self); void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, @@ -615,7 +610,8 @@ private: bool GenexOutput; }; - std::map<TargetDependsClosureKey, cmNinjaOuts> TargetDependsClosures; + std::map<TargetDependsClosureKey, cmNinjaDeps> + TargetDependsClosureLocalOutputs; TargetAliasMap TargetAliases; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 192663d..1e01dd6 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -773,9 +773,9 @@ std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand() std::string mskey; // Search in standard location. - mskey = cmStrCat( - R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\)", - this->GetToolsVersion(), ";MSBuildToolsPath"); + mskey = + cmStrCat(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\)", + this->GetToolsVersion(), ";MSBuildToolsPath"); if (cmSystemTools::ReadRegistryValue(mskey, msbuild, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(msbuild); @@ -1498,6 +1498,17 @@ bool cmGlobalVisualStudio10Generator::IsMsBuildRestoreSupported() const cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer15_7_5)); } +bool cmGlobalVisualStudio10Generator::IsBuildInParallelSupported() const +{ + if (this->Version >= VSVersion::VS16) { + return true; + } + + static std::string const vsVer15_8_0 = "15.8.27705.0"; + cm::optional<std::string> vsVer = this->GetVSInstanceVersion(); + return (vsVer && + cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer15_8_0)); +} std::string cmGlobalVisualStudio10Generator::GetClFlagTableName() const { std::string const& toolset = this->GetPlatformToolsetString(); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 63c21c5..deed206 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -168,6 +168,7 @@ public: cmIDEFlagTable const* GetNasmFlagTable() const; bool IsMsBuildRestoreSupported() const; + bool IsBuildInParallelSupported() const; protected: cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 06fd61c..de13924 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -168,7 +168,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( cmValue typeGuid, const std::set<BT<std::pair<std::string, bool>>>& depends) { fout << "Project(\"{" - << (typeGuid ? typeGuid + << (typeGuid ? *typeGuid : std::string( cmGlobalVisualStudio71Generator::ExternalProjectType( location))) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index c375d60..d483135 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -168,9 +168,9 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand() } // Search where VS15Preview places it. - vskey = cmStrCat( - R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7;)", - this->GetIDEVersion()); + vskey = + cmStrCat(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7;)", + this->GetIDEVersion()); if (cmSystemTools::ReadRegistryValue(vskey, vscmd, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(vscmd); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f19dfd5..5f28fc6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2516,10 +2516,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } // Get the product name components. - std::string pnprefix; - std::string pnbase; - std::string pnsuffix; - gtgt->GetFullNameComponents(pnprefix, pnbase, pnsuffix, configName); + cmGeneratorTarget::NameComponents const& components = + gtgt->GetFullNameComponents(configName); cmValue version = gtgt->GetProperty("VERSION"); cmValue soversion = gtgt->GetProperty("SOVERSION"); @@ -2534,8 +2532,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, version = soversion; } - std::string realName = pnbase; - std::string soName = pnbase; + std::string realName = components.base; + std::string soName = components.base; if (version && soversion) { realName += "."; realName += *version; @@ -2565,15 +2563,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, gtgt->GetType() == cmStateEnums::SHARED_LIBRARY || gtgt->GetType() == cmStateEnums::MODULE_LIBRARY || gtgt->GetType() == cmStateEnums::EXECUTABLE) { - + std::string prefix = components.prefix; if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) { - pnprefix = ""; + prefix = ""; } buildSettings->AddAttribute("EXECUTABLE_PREFIX", - this->CreateString(pnprefix)); + this->CreateString(prefix)); buildSettings->AddAttribute("EXECUTABLE_SUFFIX", - this->CreateString(pnsuffix)); + this->CreateString(components.suffix)); } // Store the product name for all target types. diff --git a/Source/cmJSONHelpers.h b/Source/cmJSONHelpers.h index 48decbc..f7151b5 100644 --- a/Source/cmJSONHelpers.h +++ b/Source/cmJSONHelpers.h @@ -36,26 +36,24 @@ struct cmJSONHelperBuilder Object& Bind(const cm::string_view& name, M U::*member, F func, bool required = true) { - return this->BindPrivate(name, - [func, member](T& out, const Json::Value* value, - CallState&&... state) -> E { - return func(out.*member, value, - std::forward(state)...); - }, - required); + return this->BindPrivate( + name, + [func, member](T& out, const Json::Value* value, CallState&&... state) + -> E { return func(out.*member, value, std::forward(state)...); }, + required); } template <typename M, typename F> Object& Bind(const cm::string_view& name, std::nullptr_t, F func, bool required = true) { - return this->BindPrivate(name, - [func](T& /*out*/, const Json::Value* value, - CallState&&... state) -> E { - M dummy; - return func(dummy, value, - std::forward(state)...); - }, - required); + return this->BindPrivate( + name, + [func](T& /*out*/, const Json::Value* value, + CallState&&... state) -> E { + M dummy; + return func(dummy, value, std::forward(state)...); + }, + required); } template <typename F> Object& Bind(const cm::string_view& name, F func, bool required = true) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cedb367..75ec694 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -430,7 +430,7 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the install prefix. cmValue installPrefix = this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX"); - std::string prefix = installPrefix; + std::string prefix = *installPrefix; #if defined(_WIN32) && !defined(__CYGWIN__) if (!installPrefix) { @@ -869,7 +869,7 @@ std::string cmLocalGenerator::GetIncludeFlags( cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))) { // if there is a separator then the flag is not repeated but is only // given once i.e. -classpath a:b:c - sep = incSep; + sep = *incSep; repeatFlag = false; } @@ -1397,7 +1397,7 @@ void cmLocalGenerator::GetDeviceLinkFlags( if (ipoEnabled) { if (cmValue cudaIPOFlags = this->Makefile->GetDefinition( "CMAKE_CUDA_DEVICE_LINK_OPTIONS_IPO")) { - linkFlags += cudaIPOFlags; + linkFlags += *cudaIPOFlags; } } @@ -1408,7 +1408,7 @@ void cmLocalGenerator::GetDeviceLinkFlags( linkPath); } - // iterate link deps and see if any of them need IPO + this->AddVisibilityPresetFlags(linkFlags, target, "CUDA"); std::vector<std::string> linkOpts; target->GetLinkOptions(linkOpts, config, "CUDA"); @@ -1848,7 +1848,7 @@ bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame( [this, sysroot](std::string const& arch) -> bool { std::string const& archSysroot = this->AppleArchSysroots[arch]; - return cmIsOff(archSysroot) || sysroot == archSysroot; + return cmIsOff(archSysroot) || *sysroot == archSysroot; }); } diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index e7a1f93..759ee7b 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -147,7 +147,7 @@ void cmLocalXCodeGenerator::AddXCConfigSources(cmGeneratorTarget* target) for (auto& config : configs) { auto file = cmGeneratorExpression::Evaluate( - xcconfig, + *xcconfig, this, config); if (!file.empty()) { target->AddSource(file); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index db8f785..d26f383 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -983,7 +983,8 @@ void cmMakefile::Generate(cmLocalGenerator& lg) this->DoGenerate(lg); cmValue oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); if (oldValue && - cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) { + cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, *oldValue, + "2.4")) { this->GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, "You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less " diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index fa29ec9..205f01f 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -8,6 +8,7 @@ #include <cm/string_view> #include <cmext/string_view> +#include "cmConfigureLog.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -64,6 +65,25 @@ void ReportCheckResult(cm::string_view what, std::string result, } } +namespace { +#ifndef CMAKE_BOOTSTRAP +void WriteMessageEvent(cmConfigureLog& log, cmMakefile const& mf, + std::string const& message) +{ + // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames. + static const std::vector<unsigned long> LogVersionsWithMessageV1{ 1 }; + + if (log.IsAnyLogVersionEnabled(LogVersionsWithMessageV1)) { + log.BeginEvent("message-v1"); + log.WriteBacktrace(mf); + log.WriteChecks(mf); + log.WriteLiteralTextBlock("message"_s, message); + log.EndEvent(); + } +} +#endif +} + } // anonymous namespace // cmLibraryCommand @@ -121,6 +141,14 @@ bool cmMessageCommand(std::vector<std::string> const& args, level = Message::LogLevel::LOG_STATUS; checkingType = CheckingType::CHECK_FAIL; ++i; + } else if (*i == "CONFIGURE_LOG") { +#ifndef CMAKE_BOOTSTRAP + if (cmConfigureLog* log = mf.GetCMakeInstance()->GetConfigureLog()) { + ++i; + WriteMessageEvent(*log, mf, cmJoin(cmMakeRange(i, args.cend()), ""_s)); + } +#endif + return true; } else if (*i == "STATUS") { level = Message::LogLevel::LOG_STATUS; ++i; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 6ec1781..d481b64 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -644,14 +644,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd( } break; case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: - break; case cmStateEnums::EXECUTABLE: - if (this->TargetLinkLanguage(config) == "Swift") { - if (this->GeneratorTarget->IsExecutableWithExports()) { - this->Makefile->GetDefExpandList("CMAKE_EXE_EXPORTS_Swift_FLAG", - linkCmds); - } - } break; default: assert(false && "Unexpected target type"); @@ -1112,7 +1105,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( this->GetObjectFilePath(source, config)); } } - if (targetType != cmStateEnums::EXECUTABLE) { + if (targetType != cmStateEnums::EXECUTABLE || + gt->IsExecutableWithExports()) { linkBuild.Outputs.push_back(vars["SWIFT_MODULE"]); } } else { @@ -1228,16 +1222,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( if (!this->SetMsvcTargetPdbVariable(vars, config)) { // It is common to place debug symbols at a specific place, // so we need a plain target name in the rule available. - std::string prefix; - std::string base; - std::string suffix; - gt->GetFullNameComponents(prefix, base, suffix, config); + cmGeneratorTarget::NameComponents const& components = + gt->GetFullNameComponents(config); std::string dbg_suffix = ".dbg"; // TODO: Where to document? if (cmValue d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) { dbg_suffix = *d; } - vars["TARGET_PDB"] = base + suffix + dbg_suffix; + vars["TARGET_PDB"] = components.base + components.suffix + dbg_suffix; } const std::string objPath = diff --git a/Source/cmRange.h b/Source/cmRange.h index 30af7d2..85cb8ea 100644 --- a/Source/cmRange.h +++ b/Source/cmRange.h @@ -76,9 +76,9 @@ class TransformIterator { public: using iterator_category = std::bidirectional_iterator_tag; - using value_type = - typename std::remove_cv<typename std::remove_reference<decltype( - std::declval<UnaryFunction>()(*std::declval<Iter>()))>::type>::type; + using value_type = typename std::remove_cv< + typename std::remove_reference<decltype(std::declval<UnaryFunction>()( + *std::declval<Iter>()))>::type>::type; using difference_type = typename std::iterator_traits<Iter>::difference_type; using pointer = value_type const*; using reference = value_type const&; diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 44f37cb..d5f6f0d 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -179,7 +179,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, cmValue arch = this->FC->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); if (cmNonempty(arch)) { - std::string archNoUnknown = arch; + std::string archNoUnknown = *arch; auto unknownAtPos = archNoUnknown.find("-unknown-"); bool foundUnknown = unknownAtPos != std::string::npos; if (foundUnknown) { diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 521cf63..de1e3b0 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -619,10 +619,9 @@ bool HandleSource(cmSourceFile* sf, const std::string& propertyName, if (propertyName == "GENERATED") { SetPropertyCommand::PropertyOp op = (remove) ? SetPropertyCommand::PropertyOp::Remove - : (appendAsString) - ? SetPropertyCommand::PropertyOp::AppendAsString - : (appendMode) ? SetPropertyCommand::PropertyOp::Append - : SetPropertyCommand::PropertyOp::Set; + : (appendAsString) ? SetPropertyCommand::PropertyOp::AppendAsString + : (appendMode) ? SetPropertyCommand::PropertyOp::Append + : SetPropertyCommand::PropertyOp::Set; return SetPropertyCommand::HandleAndValidateSourceFilePropertyGENERATED( sf, propertyValue, op); } diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index cb5f11f..e230702 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -301,14 +301,6 @@ void cmStateSnapshot::SetDefaultDefinitions() this->SetDefinition("UNIX", "1"); this->SetDefinition("CMAKE_HOST_UNIX", "1"); } -#if defined(__CYGWIN__) - std::string legacy; - if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) && - cmIsOn(legacy)) { - this->SetDefinition("WIN32", "1"); - this->SetDefinition("CMAKE_HOST_WIN32", "1"); - } -#endif #if defined(__APPLE__) this->SetDefinition("APPLE", "1"); this->SetDefinition("CMAKE_HOST_APPLE", "1"); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f94c4d3..0b29b0d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3044,7 +3044,7 @@ static cm::optional<bool> SetRPathELF(std::string const& file, { auto adjustCallback = [newRPath](cm::optional<std::string>& outRPath, const std::string& inRPath, - const char* /*se_name*/, std::string * + const char* /*se_name*/, std::string* /*emsg*/) -> bool { if (inRPath != newRPath) { outRPath = newRPath; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9734414..5065876 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -550,7 +550,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( e1.Element("Platform", this->Platform); cmValue projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL"); - e1.Element("ProjectName", projLabel ? projLabel : this->Name); + e1.Element("ProjectName", projLabel ? *projLabel : this->Name); { cm::optional<std::string> targetFramework; cm::optional<std::string> targetFrameworkVersion; @@ -1807,7 +1807,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( outputs.str(), comment, ccg); } else { this->WriteCustomRuleCpp(*spe2, c, script, additional_inputs.str(), - outputs.str(), comment, ccg, symbolic); + outputs.str(), comment, ccg, symbolic, + command.GetUsesTerminal()); } } } @@ -1816,9 +1817,12 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp( Elem& e2, std::string const& config, std::string const& script, std::string const& additional_inputs, std::string const& outputs, std::string const& comment, cmCustomCommandGenerator const& ccg, - bool symbolic) + bool symbolic, bool uses_terminal) { const std::string cond = this->CalcCondition(config); + if (this->GlobalGenerator->IsBuildInParallelSupported() && !uses_terminal) { + e2.WritePlatformConfigTag("BuildInParallel", cond, "true"); + } e2.WritePlatformConfigTag("Message", cond, comment); e2.WritePlatformConfigTag("Command", cond, script); e2.WritePlatformConfigTag("AdditionalInputs", cond, additional_inputs); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 166cdf7..194fbaa 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -157,7 +157,8 @@ private: std::string const& additional_inputs, std::string const& outputs, std::string const& comment, - cmCustomCommandGenerator const& ccg, bool symbolic); + cmCustomCommandGenerator const& ccg, bool symbolic, + bool uses_terminal); void WriteCustomRuleCSharp(Elem& e0, std::string const& config, std::string const& commandName, std::string const& script, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0d947a5..468ff73 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2416,9 +2416,6 @@ int cmake::ActualConfigure() // info to save time if (!this->GetIsInTryCompile()) { this->GlobalGenerator->ClearEnabledLanguages(); - - this->TruncateOutputLog("CMakeOutput.log"); - this->TruncateOutputLog("CMakeError.log"); } #if !defined(CMAKE_BOOTSTRAP) diff --git a/Source/kwsys/CONTRIBUTING.rst b/Source/kwsys/CONTRIBUTING.rst index 32e7b83..ebd3ed3 100644 --- a/Source/kwsys/CONTRIBUTING.rst +++ b/Source/kwsys/CONTRIBUTING.rst @@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes. Code Style ========== -We use `clang-format`_ version **6.0** to define our style for C++ code in +We use `clang-format`_ version **15** to define our style for C++ code in the KWSys source tree. See the `.clang-format`_ configuration file for our style settings. Use the `clang-format.bash`_ script to format source code. It automatically runs ``clang-format`` on the set of source files diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx index e45db36..ccd5f6d 100644 --- a/Source/kwsys/CommandLineArguments.cxx +++ b/Source/kwsys/CommandLineArguments.cxx @@ -319,7 +319,7 @@ void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv) { int cc; for (cc = 0; cc < argc; ++cc) { - delete[](*argv)[cc]; + delete[] (*argv)[cc]; } delete[] * argv; } diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index fa2c295..92eae41 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -390,8 +390,8 @@ bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages) #endif // Handle drive letters on Windows if (expr[1] == ':' && expr[0] != '/') { - skip = 2; - } + skip = 2; + } } if (skip > 0) { diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index 17e1507..0b43b4a 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -2406,8 +2406,9 @@ static int kwsysProcess_List__Next_NT4(kwsysProcess_List* self) { if (self->CurrentInfo) { if (self->CurrentInfo->NextEntryDelta > 0) { - self->CurrentInfo = ((PSYSTEM_PROCESS_INFORMATION)( - (char*)self->CurrentInfo + self->CurrentInfo->NextEntryDelta)); + self->CurrentInfo = + ((PSYSTEM_PROCESS_INFORMATION)((char*)self->CurrentInfo + + self->CurrentInfo->NextEntryDelta)); return 1; } self->CurrentInfo = 0; diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx index fb4e380..c96a96d 100644 --- a/Source/kwsys/RegularExpression.cxx +++ b/Source/kwsys/RegularExpression.cxx @@ -366,9 +366,9 @@ bool RegularExpression::compile(const char* exp) } // Allocate space. - //#ifndef _WIN32 + // #ifndef _WIN32 delete[] this->program; - //#endif + // #endif this->program = new char[comp.regsize]; this->progsize = static_cast<int>(comp.regsize); diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in index 2709cde..2cb7f5e 100644 --- a/Source/kwsys/RegularExpression.hxx.in +++ b/Source/kwsys/RegularExpression.hxx.in @@ -456,9 +456,9 @@ inline RegularExpression::RegularExpression(const std::string& s) */ inline RegularExpression::~RegularExpression() { - //#ifndef _WIN32 + // #ifndef _WIN32 delete[] this->program; - //#endif + // #endif } /** @@ -556,9 +556,9 @@ inline bool RegularExpression::is_valid() const inline void RegularExpression::set_invalid() { - //#ifndef _WIN32 + // #ifndef _WIN32 delete[] this->program; - //#endif + // #endif this->program = nullptr; } diff --git a/Source/kwsys/kwsysPrivate.h b/Source/kwsys/kwsysPrivate.h index dd9c127..2f5c2fa 100644 --- a/Source/kwsys/kwsysPrivate.h +++ b/Source/kwsys/kwsysPrivate.h @@ -27,7 +27,7 @@ */ # define KWSYS_NAMESPACE_STRING KWSYS_NAMESPACE_STRING0(KWSYS_NAMESPACE) # define KWSYS_NAMESPACE_STRING0(x) KWSYS_NAMESPACE_STRING1(x) -# define KWSYS_NAMESPACE_STRING1(x) # x +# define KWSYS_NAMESPACE_STRING1(x) #x #else # error "kwsysPrivate.h included multiple times." diff --git a/Source/kwsys/testConfigure.cxx b/Source/kwsys/testConfigure.cxx index a3c2ed3..4a34e1c 100644 --- a/Source/kwsys/testConfigure.cxx +++ b/Source/kwsys/testConfigure.cxx @@ -22,7 +22,7 @@ static bool testFallthrough(int n) return r == 2; } -int testConfigure(int, char* []) +int testConfigure(int, char*[]) { bool res = true; res = testFallthrough(1) && res; diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx index 4b7ddf0..f9b826d 100644 --- a/Source/kwsys/testConsoleBuf.cxx +++ b/Source/kwsys/testConsoleBuf.cxx @@ -743,7 +743,7 @@ static int testConsole() #endif -int testConsoleBuf(int, char* []) +int testConsoleBuf(int, char*[]) { int ret = 0; diff --git a/Source/kwsys/testDirectory.cxx b/Source/kwsys/testDirectory.cxx index 79bdc98..8c73af2 100644 --- a/Source/kwsys/testDirectory.cxx +++ b/Source/kwsys/testDirectory.cxx @@ -19,7 +19,7 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #include <testSystemTools.h> -static int _doLongPathTest() +static int doLongPathTest() { using namespace kwsys; static const int LONG_PATH_THRESHOLD = 512; @@ -77,7 +77,7 @@ static int _doLongPathTest() return res; } -static int _nonExistentDirectoryTest() +static int nonExistentDirectoryTest() { using namespace kwsys; int res = 0; @@ -105,7 +105,7 @@ static int _nonExistentDirectoryTest() return res; } -static int _copyDirectoryTest() +static int copyDirectoryTest() { using namespace kwsys; const std::string source(TEST_SYSTEMTOOLS_BINARY_DIR @@ -136,8 +136,7 @@ static int _copyDirectoryTest() return 0; } -int testDirectory(int, char* []) +int testDirectory(int, char*[]) { - return _doLongPathTest() + _nonExistentDirectoryTest() + - _copyDirectoryTest(); + return doLongPathTest() + nonExistentDirectoryTest() + copyDirectoryTest(); } diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx index 1d605cb..3acb6c8 100644 --- a/Source/kwsys/testEncoding.cxx +++ b/Source/kwsys/testEncoding.cxx @@ -266,7 +266,7 @@ static int testToWindowsExtendedPath() #endif } -int testEncoding(int, char* []) +int testEncoding(int, char*[]) { const char* loc = setlocale(LC_ALL, ""); if (loc) { diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx index 3325e20..9897a58 100644 --- a/Source/kwsys/testFStream.cxx +++ b/Source/kwsys/testFStream.cxx @@ -136,7 +136,7 @@ static int testBOMIO() return 0; } -int testFStream(int, char* []) +int testFStream(int, char*[]) { int ret = 0; diff --git a/Source/kwsys/testStatus.cxx b/Source/kwsys/testStatus.cxx index 0a767a8..9cadada 100644 --- a/Source/kwsys/testStatus.cxx +++ b/Source/kwsys/testStatus.cxx @@ -16,7 +16,7 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ # include <windows.h> #endif -int testStatus(int, char* []) +int testStatus(int, char*[]) { bool res = true; { diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx index 4f0c522..7ae94ff 100644 --- a/Source/kwsys/testSystemInformation.cxx +++ b/Source/kwsys/testSystemInformation.cxx @@ -19,7 +19,7 @@ #define printMethod3(info, m, unit) \ std::cout << #m << ": " << info.m << " " << unit << "\n" -int testSystemInformation(int, char* []) +int testSystemInformation(int, char*[]) { std::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 487da8d..8afcb68 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -1209,7 +1209,7 @@ static bool CheckSplitString() return ret; } -int testSystemTools(int, char* []) +int testSystemTools(int, char*[]) { bool res = true; |