mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 14:48:19 -05:00
cmValue: Use operator* explicitly to convert to std::string; avoid extra call
This commit is contained in:
@@ -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")) {
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"))) {
|
||||
|
||||
@@ -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")) {
|
||||
|
||||
@@ -3572,7 +3572,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5987,7 +5987,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*/)
|
||||
|
||||
@@ -947,7 +947,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 "
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user