summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-07-27 23:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-07-28 12:31:31 (GMT)
commitf37c14e93036fe01fca3539f539ff8821494e9d1 (patch)
treefc08ddab0c3e9b47f00cff9a287cc89a2afa13ca /Source/CPack
parent261a2585d9df7113a5ba7c9beacb641754444523 (diff)
downloadCMake-f37c14e93036fe01fca3539f539ff8821494e9d1.zip
CMake-f37c14e93036fe01fca3539f539ff8821494e9d1.tar.gz
CMake-f37c14e93036fe01fca3539f539ff8821494e9d1.tar.bz2
Source: use cmNonempty()
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx28
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx40
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx2
4 files changed, 37 insertions, 37 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 3d5fe6b..560e5c1 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -696,57 +696,57 @@ int cmCPackDebGenerator::createDeb()
const char* debian_pkg_source =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE");
- if (debian_pkg_source && *debian_pkg_source) {
+ if (cmNonempty(debian_pkg_source)) {
controlValues["Source"] = debian_pkg_source;
}
const char* debian_pkg_dep =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_DEPENDS");
- if (debian_pkg_dep && *debian_pkg_dep) {
+ if (cmNonempty(debian_pkg_dep)) {
controlValues["Depends"] = debian_pkg_dep;
}
const char* debian_pkg_rec =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS");
- if (debian_pkg_rec && *debian_pkg_rec) {
+ if (cmNonempty(debian_pkg_rec)) {
controlValues["Recommends"] = debian_pkg_rec;
}
const char* debian_pkg_sug =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS");
- if (debian_pkg_sug && *debian_pkg_sug) {
+ if (cmNonempty(debian_pkg_sug)) {
controlValues["Suggests"] = debian_pkg_sug;
}
const char* debian_pkg_url =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE");
- if (debian_pkg_url && *debian_pkg_url) {
+ if (cmNonempty(debian_pkg_url)) {
controlValues["Homepage"] = debian_pkg_url;
}
const char* debian_pkg_predep =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS");
- if (debian_pkg_predep && *debian_pkg_predep) {
+ if (cmNonempty(debian_pkg_predep)) {
controlValues["Pre-Depends"] = debian_pkg_predep;
}
const char* debian_pkg_enhances =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_ENHANCES");
- if (debian_pkg_enhances && *debian_pkg_enhances) {
+ if (cmNonempty(debian_pkg_enhances)) {
controlValues["Enhances"] = debian_pkg_enhances;
}
const char* debian_pkg_breaks =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_BREAKS");
- if (debian_pkg_breaks && *debian_pkg_breaks) {
+ if (cmNonempty(debian_pkg_breaks)) {
controlValues["Breaks"] = debian_pkg_breaks;
}
const char* debian_pkg_conflicts =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS");
- if (debian_pkg_conflicts && *debian_pkg_conflicts) {
+ if (cmNonempty(debian_pkg_conflicts)) {
controlValues["Conflicts"] = debian_pkg_conflicts;
}
const char* debian_pkg_provides =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_PROVIDES");
- if (debian_pkg_provides && *debian_pkg_provides) {
+ if (cmNonempty(debian_pkg_provides)) {
controlValues["Provides"] = debian_pkg_provides;
}
const char* debian_pkg_replaces =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_REPLACES");
- if (debian_pkg_replaces && *debian_pkg_replaces) {
+ if (cmNonempty(debian_pkg_replaces)) {
controlValues["Replaces"] = debian_pkg_replaces;
}
@@ -756,7 +756,7 @@ int cmCPackDebGenerator::createDeb()
const char* debian_pkg_shlibs =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SHLIBS");
const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") &&
- debian_pkg_shlibs && *debian_pkg_shlibs;
+ cmNonempty(debian_pkg_shlibs);
if (gen_shibs) {
cmGeneratedFileStream out;
out.Open(shlibsfilename, false, true);
@@ -832,11 +832,11 @@ int cmCPackDebGenerator::createDbgsymDDeb()
const char* debian_pkg_source =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE");
- if (debian_pkg_source && *debian_pkg_source) {
+ if (cmNonempty(debian_pkg_source)) {
controlValues["Source"] = debian_pkg_source;
}
const char* debian_build_ids = this->GetOption("GEN_BUILD_IDS");
- if (debian_build_ids && *debian_build_ids) {
+ if (cmNonempty(debian_build_ids)) {
controlValues["Build-Ids"] = debian_build_ids;
}
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 53be4fe..0bc8456 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -61,7 +61,7 @@ int cmCPackExternalGenerator::PackageFiles()
}
const char* packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT");
- if (packageScript && *packageScript) {
+ if (cmNonempty(packageScript)) {
if (!cmSystemTools::FileIsFullPath(packageScript)) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
@@ -211,7 +211,7 @@ int cmCPackExternalGenerator::cmCPackExternalVersionGenerator::WriteToJSON(
const char* defaultDirectoryPermissions =
this->Parent->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
- if (defaultDirectoryPermissions && *defaultDirectoryPermissions) {
+ if (cmNonempty(defaultDirectoryPermissions)) {
root["defaultDirectoryPermissions"] = defaultDirectoryPermissions;
}
if (cmIsInternallyOn(this->Parent->GetOption("CPACK_SET_DESTDIR"))) {
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index c641175..3880f65 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -216,7 +216,7 @@ int cmCPackGenerator::InstallProject()
mode_t* default_dir_mode = nullptr;
const char* default_dir_install_permissions =
this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
- if (default_dir_install_permissions && *default_dir_install_permissions) {
+ if (cmNonempty(default_dir_install_permissions)) {
std::vector<std::string> items =
cmExpandedList(default_dir_install_permissions);
for (const auto& arg : items) {
@@ -293,7 +293,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
{
(void)setDestDir;
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
- if (installCommands && *installCommands) {
+ if (cmNonempty(installCommands)) {
std::string tempInstallDirectoryEnv =
cmStrCat("CMAKE_INSTALL_PREFIX=", tempInstallDirectory);
cmSystemTools::PutEnv(tempInstallDirectoryEnv);
@@ -344,7 +344,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
const char* installDirectories =
this->GetOption("CPACK_INSTALLED_DIRECTORIES");
- if (installDirectories && *installDirectories) {
+ if (cmNonempty(installDirectories)) {
std::vector<std::string> installDirectoriesVector =
cmExpandedList(installDirectories);
if (installDirectoriesVector.size() % 2 != 0) {
@@ -541,7 +541,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
const char* cmakeProjects = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
const char* cmakeGenerator = this->GetOption("CPACK_CMAKE_GENERATOR");
std::string absoluteDestFiles;
- if (cmakeProjects && *cmakeProjects) {
+ if (cmNonempty(cmakeProjects)) {
if (!cmakeGenerator) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_INSTALL_CMAKE_PROJECTS is specified, but "
@@ -594,7 +594,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
std::string installTypesVar = "CPACK_" +
cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
const char* installTypes = this->GetOption(installTypesVar);
- if (installTypes && *installTypes) {
+ if (cmNonempty(installTypes)) {
std::vector<std::string> installTypesVector =
cmExpandedList(installTypes);
for (std::string const& installType : installTypesVector) {
@@ -607,7 +607,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
std::string componentsVar =
"CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component);
const char* components = this->GetOption(componentsVar);
- if (components && *components) {
+ if (cmNonempty(components)) {
cmExpandList(components, componentsVector);
for (std::string const& comp : componentsVector) {
project.Components.push_back(
@@ -771,7 +771,7 @@ int cmCPackGenerator::InstallCMakeProject(
const char* default_dir_inst_permissions =
this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
- if (default_dir_inst_permissions && *default_dir_inst_permissions) {
+ if (cmNonempty(default_dir_inst_permissions)) {
mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS",
default_dir_inst_permissions);
}
@@ -983,7 +983,7 @@ void cmCPackGenerator::SetOptionIfNotSet(const std::string& op,
const char* value)
{
const char* def = this->MakefileMap->GetDefinition(op);
- if (def && *def) {
+ if (cmNonempty(def)) {
return;
}
this->SetOption(op, value);
@@ -1215,7 +1215,7 @@ bool cmCPackGenerator::IsOn(const std::string& name) const
bool cmCPackGenerator::IsSetToOff(const std::string& op) const
{
const char* ret = this->MakefileMap->GetDefinition(op);
- if (ret && *ret) {
+ if (cmNonempty(ret)) {
return cmIsOff(ret);
}
return false;
@@ -1509,7 +1509,7 @@ cmCPackInstallationType* cmCPackGenerator::GetInstallationType(
installType->Name = name;
const char* displayName = this->GetOption(macroPrefix + "_DISPLAY_NAME");
- if (displayName && *displayName) {
+ if (cmNonempty(displayName)) {
installType->DisplayName = displayName;
} else {
installType->DisplayName = installType->Name;
@@ -1531,7 +1531,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
"CPACK_COMPONENT_" + cmsys::SystemTools::UpperCase(name);
component->Name = name;
const char* displayName = this->GetOption(macroPrefix + "_DISPLAY_NAME");
- if (displayName && *displayName) {
+ if (cmNonempty(displayName)) {
component->DisplayName = displayName;
} else {
component->DisplayName = component->Name;
@@ -1543,17 +1543,17 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
cmIsOn(this->GetOption("CPACK_DOWNLOAD_ALL"));
const char* archiveFile = this->GetOption(macroPrefix + "_ARCHIVE_FILE");
- if (archiveFile && *archiveFile) {
+ if (cmNonempty(archiveFile)) {
component->ArchiveFile = archiveFile;
}
const char* plist = this->GetOption(macroPrefix + "_PLIST");
- if (plist && *plist) {
+ if (cmNonempty(plist)) {
component->Plist = plist;
}
const char* groupName = this->GetOption(macroPrefix + "_GROUP");
- if (groupName && *groupName) {
+ if (cmNonempty(groupName)) {
component->Group = GetComponentGroup(projectName, groupName);
component->Group->Components.push_back(component);
} else {
@@ -1561,13 +1561,13 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
}
const char* description = this->GetOption(macroPrefix + "_DESCRIPTION");
- if (description && *description) {
+ if (cmNonempty(description)) {
component->Description = description;
}
// Determine the installation types.
const char* installTypes = this->GetOption(macroPrefix + "_INSTALL_TYPES");
- if (installTypes && *installTypes) {
+ if (cmNonempty(installTypes)) {
std::vector<std::string> installTypesVector =
cmExpandedList(installTypes);
for (std::string const& installType : installTypesVector) {
@@ -1578,7 +1578,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
// Determine the component dependencies.
const char* depends = this->GetOption(macroPrefix + "_DEPENDS");
- if (depends && *depends) {
+ if (cmNonempty(depends)) {
std::vector<std::string> dependsVector = cmExpandedList(depends);
for (std::string const& depend : dependsVector) {
cmCPackComponent* child = GetComponent(projectName, depend);
@@ -1602,21 +1602,21 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup(
// Define the group
group->Name = name;
const char* displayName = this->GetOption(macroPrefix + "_DISPLAY_NAME");
- if (displayName && *displayName) {
+ if (cmNonempty(displayName)) {
group->DisplayName = displayName;
} else {
group->DisplayName = group->Name;
}
const char* description = this->GetOption(macroPrefix + "_DESCRIPTION");
- if (description && *description) {
+ if (cmNonempty(description)) {
group->Description = description;
}
group->IsBold = this->IsOn(macroPrefix + "_BOLD_TITLE");
group->IsExpandedByDefault = this->IsOn(macroPrefix + "_EXPANDED");
const char* parentGroupName =
this->GetOption(macroPrefix + "_PARENT_GROUP");
- if (parentGroupName && *parentGroupName) {
+ if (cmNonempty(parentGroupName)) {
group->ParentGroup = GetComponentGroup(projectName, parentGroupName);
group->ParentGroup->Subgroups.push_back(group);
} else {
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 058b090..2109b4e 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -696,7 +696,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
const char* userUploadDirectory =
this->GetOption("CPACK_UPLOAD_DIRECTORY");
std::string uploadDirectory;
- if (userUploadDirectory && *userUploadDirectory) {
+ if (cmNonempty(userUploadDirectory)) {
uploadDirectory = userUploadDirectory;
} else {
uploadDirectory =