Source: Use cmValue::IsOn and IsOff

Speed up a bit by calling members directly.
This commit is contained in:
Vitaly Stakhovsky 2024-03-17 19:00:00 -04:00
parent f440439dee
commit 1a49b439a5
42 changed files with 121 additions and 116 deletions

View File

@ -416,10 +416,10 @@ int cmCPackIFWGenerator::InitializeInternal()
}
if (cmValue ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
this->OnlineOnly = cmIsOn(ifwDownloadAll);
this->OnlineOnly = ifwDownloadAll.IsOn();
} else if (cmValue cpackDownloadAll =
this->GetOption("CPACK_DOWNLOAD_ALL")) {
this->OnlineOnly = cmIsOn(cpackDownloadAll);
this->OnlineOnly = cpackDownloadAll.IsOn();
} else {
this->OnlineOnly = false;
}

View File

@ -235,7 +235,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions);
CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions);
if (!cmIsOn(GetOption("CPACK_WIX_SKIP_WIX_UI_EXTENSION"))) {
if (!GetOption("CPACK_WIX_SKIP_WIX_UI_EXTENSION").IsOn()) {
this->LightExtensions.insert("WixUIExtension");
}
CollectExtensions("CPACK_WIX_EXTENSIONS", this->LightExtensions);
@ -255,7 +255,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
// if install folder is supposed to be set absolutely, the default
// component guid "*" cannot be used
if (cmIsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
if (GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER").IsOn()) {
this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID;
}
@ -613,7 +613,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string cmCPackWIXGenerator::GetRootFolderId() const
{
if (cmIsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
if (GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER").IsOn()) {
return "";
}

View File

@ -527,7 +527,7 @@ cmCPackDebGenerator::~cmCPackDebGenerator() = default;
int cmCPackDebGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
if (cmIsOff(this->GetOption("CPACK_SET_DESTDIR"))) {
if (this->GetOption("CPACK_SET_DESTDIR").IsOff()) {
this->SetOption("CPACK_SET_DESTDIR", "I_ON");
}
return this->Superclass::InitializeInternal();

View File

@ -156,7 +156,7 @@ int cmCPackExternalGenerator::InstallCMakeProject(
bool cmCPackExternalGenerator::StagingEnabled() const
{
return !cmIsOff(this->GetOption("CPACK_EXTERNAL_ENABLE_STAGING"));
return !this->GetOption("CPACK_EXTERNAL_ENABLE_STAGING").IsOff();
}
cmCPackExternalGenerator::cmCPackExternalVersionGenerator::
@ -221,7 +221,7 @@ int cmCPackExternalGenerator::cmCPackExternalVersionGenerator::WriteToJSON(
root["setDestdir"] = false;
}
root["stripFiles"] = !cmIsOff(this->Parent->GetOption("CPACK_STRIP_FILES"));
root["stripFiles"] = !this->Parent->GetOption("CPACK_STRIP_FILES").IsOff();
root["warnOnAbsoluteInstallDestination"] =
this->Parent->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION");
root["errorOnAbsoluteInstallDestination"] =

View File

@ -187,7 +187,7 @@ int cmCPackGenerator::InstallProject()
std::string bareTempInstallDirectory =
this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
std::string tempInstallDirectoryStr = bareTempInstallDirectory;
bool setDestDir = cmIsOn(this->GetOption("CPACK_SET_DESTDIR")) ||
bool setDestDir = this->GetOption("CPACK_SET_DESTDIR").IsOn() ||
cmIsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"));
if (!setDestDir) {
tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
@ -855,7 +855,7 @@ int cmCPackGenerator::InstallCMakeProject(
// strip on TRUE, ON, 1, one or several file names, but not on
// FALSE, OFF, 0 and an empty string
if (!cmIsOff(this->GetOption("CPACK_STRIP_FILES"))) {
if (!this->GetOption("CPACK_STRIP_FILES").IsOff()) {
mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
}
// Remember the list of files before installation
@ -1041,7 +1041,7 @@ int cmCPackGenerator::DoPackage()
return 0;
}
if (cmIsOn(this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY"))) {
if (this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY").IsOn()) {
cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) {
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
@ -1089,7 +1089,7 @@ int cmCPackGenerator::DoPackage()
"Remove old package file" << std::endl);
cmSystemTools::RemoveFile(*tempPackageFileName);
}
if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) {
if (this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
}
@ -1231,14 +1231,14 @@ bool cmCPackGenerator::IsSet(const std::string& name) const
bool cmCPackGenerator::IsOn(const std::string& name) const
{
return cmIsOn(this->GetOption(name));
return this->GetOption(name).IsOn();
}
bool cmCPackGenerator::IsSetToOff(const std::string& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (cmNonempty(ret)) {
return cmIsOff(*ret);
return ret.IsOff();
}
return false;
}
@ -1560,7 +1560,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
component->IsRequired = this->IsOn(macroPrefix + "_REQUIRED");
component->IsDisabledByDefault = this->IsOn(macroPrefix + "_DISABLED");
component->IsDownloaded = this->IsOn(macroPrefix + "_DOWNLOADED") ||
cmIsOn(this->GetOption("CPACK_DOWNLOAD_ALL"));
this->GetOption("CPACK_DOWNLOAD_ALL").IsOn();
cmValue archiveFile = this->GetOption(macroPrefix + "_ARCHIVE_FILE");
if (cmNonempty(archiveFile)) {

View File

@ -34,7 +34,7 @@ bool cmCPackInnoSetupGenerator::CanGenerate()
int cmCPackInnoSetupGenerator::InitializeInternal()
{
if (cmIsOn(GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) {
if (GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
cmCPackLogger(cmCPackLog::LOG_WARNING,
"Inno Setup Generator cannot work with "
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
@ -938,7 +938,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
// Build the list of files to go into this archive
const std::string& zipListFileName =
cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
const bool needQuotesInFile = cmIsOn(GetOption("CPACK_ZIP_NEED_QUOTES"));
const bool needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(zipListFileName);
for (const std::string& i : component->Files) {

View File

@ -365,7 +365,7 @@ int cmCPackNSISGenerator::PackageFiles()
if (anyDownloadedComponents) {
defines += "!define CPACK_USES_DOWNLOAD\n";
if (cmIsOn(this->GetOption("CPACK_ADD_REMOVE"))) {
if (this->GetOption("CPACK_ADD_REMOVE").IsOn()) {
defines += "!define CPACK_NSIS_ADD_REMOVE\n";
}
}
@ -412,7 +412,7 @@ int cmCPackNSISGenerator::PackageFiles()
int cmCPackNSISGenerator::InitializeInternal()
{
if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) {
if (this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
cmCPackLogger(
cmCPackLog::LOG_WARNING,
"NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
@ -801,7 +801,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
// size of the installed component.
std::string zipListFileName = cmStrCat(
this->GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
bool needQuotesInFile = cmIsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES"));
bool needQuotesInFile = this->GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
unsigned long totalSize = 0;
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(zipListFileName);

View File

@ -297,7 +297,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&MD5=";
if (cmIsOn(this->GetOption("InternalTest"))) {
if (this->GetOption("InternalTest").IsOn()) {
upload_as += "ffffffffffffffffffffffffffffffff";
} else {
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
@ -539,7 +539,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
fields = url.substr(pos + 1);
url.erase(pos);
}
bool internalTest = cmIsOn(this->GetOption("InternalTest"));
bool internalTest = this->GetOption("InternalTest").IsOn();
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
std::string retryDelayString = *this->GetOption("RetryDelay");

View File

@ -522,8 +522,8 @@ bool cmCTestTestHandler::ProcessOptions()
{
// Update internal data structure from generic one
this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
this->SetUseUnion(cmIsOn(this->GetOption("UseUnion")));
if (cmIsOn(this->GetOption("ScheduleRandom"))) {
this->SetUseUnion(this->GetOption("UseUnion").IsOn());
if (this->GetOption("ScheduleRandom").IsOn()) {
this->CTest->SetScheduleType("Random");
}
if (cmValue repeat = this->GetOption("Repeat")) {
@ -609,7 +609,7 @@ bool cmCTestTestHandler::ProcessOptions()
if (val) {
this->ExcludeTestListFile = val;
}
this->SetRerunFailed(cmIsOn(this->GetOption("RerunFailed")));
this->SetRerunFailed(this->GetOption("RerunFailed").IsOn());
return true;
}

View File

@ -54,7 +54,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
switch (state->GetCacheEntryType(key)) {
case cmStateEnums::BOOL: {
auto bw = cm::make_unique<cmCursesBoolWidget>(this->EntryWidth, 1, 1, 1);
bw->SetValueAsBool(cmIsOn(*value));
bw->SetValueAsBool(value.IsOn());
this->Entry = std::move(bw);
break;
}

View File

@ -26,7 +26,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
if (cmIsOff(mf.GetDefinition("BUILD_SHARED_LIBS"))) {
if (mf.GetDefinition("BUILD_SHARED_LIBS").IsOff()) {
type = cmStateEnums::STATIC_LIBRARY;
}
bool excludeFromAll = false;

View File

@ -577,7 +577,7 @@ cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
bool cmCacheManager::CacheEntry::GetPropertyAsBool(
const std::string& prop) const
{
return cmIsOn(this->GetProperty(prop));
return this->GetProperty(prop).IsOn();
}
void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,

View File

@ -295,7 +295,7 @@ std::string cmCommonTargetGenerator::GetAIXExports(std::string const&)
if (this->GeneratorTarget->IsAIX()) {
if (cmValue exportAll =
this->GeneratorTarget->GetProperty("AIX_EXPORT_ALL_SYMBOLS")) {
if (cmIsOff(*exportAll)) {
if (exportAll.IsOff()) {
aixExports = "-n";
}
}

View File

@ -646,7 +646,7 @@ bool cmComputeLinkInformation::Compute()
// Restore the target link type so the correct system runtime
// libraries are found.
cmValue lss = this->Target->GetProperty("LINK_SEARCH_END_STATIC");
if (cmIsOn(lss)) {
if (lss.IsOn()) {
this->SetCurrentLinkType(LinkStatic);
} else {
this->SetCurrentLinkType(this->StartLinkType);
@ -1451,7 +1451,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
// Lookup the starting link type from the target (linked statically?).
cmValue lss = this->Target->GetProperty("LINK_SEARCH_START_STATIC");
this->StartLinkType = cmIsOn(lss) ? LinkStatic : LinkShared;
this->StartLinkType = lss.IsOn() ? LinkStatic : LinkShared;
this->CurrentLinkType = this->StartLinkType;
}

View File

@ -473,7 +473,7 @@ void cmComputeTargetDepends::ComputeIntermediateGraph()
} else {
if (cmValue optimizeDependencies =
gt->GetProperty("OPTIMIZE_DEPENDENCIES")) {
if (cmIsOn(optimizeDependencies)) {
if (optimizeDependencies.IsOn()) {
this->OptimizeLinkDependencies(gt, intermediateEdges, initialEdges);
} else {
intermediateEdges = initialEdges;

View File

@ -399,7 +399,7 @@ bool cmConditionEvaluator::GetBooleanValue(
// Check definition.
cmValue def = this->GetDefinitionIfUnquoted(arg);
return !cmIsOff(def);
return !def.IsOff();
}
//=========================================================================
@ -416,14 +416,14 @@ bool cmConditionEvaluator::GetBooleanValueOld(
return true;
}
cmValue def = this->GetDefinitionIfUnquoted(arg);
return !cmIsOff(def);
return !def.IsOff();
}
// Old GetVariableOrNumber behavior.
cmValue def = this->GetDefinitionIfUnquoted(arg);
if (!def && std::atoi(arg.GetValue().c_str())) {
def = cmValue(arg.GetValue());
}
return !cmIsOff(def);
return !def.IsOff();
}
//=========================================================================

View File

@ -207,7 +207,7 @@ void cmFindCommon::SelectDefaultSearchModes()
for (auto const& path : search_paths) {
cmValue def = this->Makefile->GetDefinition(path.second);
if (def) {
path.first = !cmIsOn(*def);
path.first = !def.IsOn();
}
}
}

View File

@ -628,7 +628,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// priority over the deprecated CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
if (cmValue const def =
this->Makefile->GetDefinition("CMAKE_FIND_USE_PACKAGE_REGISTRY")) {
this->NoUserRegistry = !cmIsOn(*def);
this->NoUserRegistry = !def.IsOn();
} else if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
this->NoUserRegistry = true;
}
@ -638,7 +638,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// priority over the deprecated CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
if (cmValue const def = this->Makefile->GetDefinition(
"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY")) {
this->NoSystemRegistry = !cmIsOn(*def);
this->NoSystemRegistry = !def.IsOn();
} else if (this->Makefile->IsOn(
"CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY")) {
this->NoSystemRegistry = true;
@ -1420,7 +1420,7 @@ bool cmFindPackageCommand::HandlePackageMode(
// Try to load the config file if the directory is known
bool fileFound = false;
if (this->UseConfigFiles) {
if (!cmIsOff(def)) {
if (!def.IsOff()) {
// Get the directory from the variable value.
std::string dir = *def;
cmSystemTools::ConvertToUnixSlashes(dir);
@ -1440,7 +1440,7 @@ bool cmFindPackageCommand::HandlePackageMode(
}
// Search for the config file if it is not already found.
if (cmIsOff(def) || !fileFound) {
if (def.IsOff() || !fileFound) {
fileFound = this->FindConfig();
}

View File

@ -918,7 +918,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
{
cmValue feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config);
if (!cmIsOn(feature)) {
if (!feature.IsOn()) {
// 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies
return false;
}
@ -1084,8 +1084,8 @@ cmValue cmGeneratorTarget::GetLanguageExtensions(std::string const& lang) const
bool cmGeneratorTarget::GetLanguageStandardRequired(
std::string const& lang) const
{
return cmIsOn(
this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED"));
return this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED")
.IsOn();
}
void cmGeneratorTarget::GetModuleDefinitionSources(
@ -2422,7 +2422,7 @@ bool cmGeneratorTarget::MacOSXUseInstallNameDir() const
cmValue build_with_install_name =
this->GetProperty("BUILD_WITH_INSTALL_NAME_DIR");
if (build_with_install_name) {
return cmIsOn(*build_with_install_name);
return build_with_install_name.IsOn();
}
cmPolicies::PolicyStatus cmp0068 = this->GetPolicyStatusCMP0068();
@ -6768,7 +6768,7 @@ bool cmGeneratorTarget::IsFortranBuildingInstrinsicModules() const
{
if (cmValue prop =
this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) {
return cmIsOn(*prop);
return prop.IsOn();
}
return false;
}
@ -7881,9 +7881,9 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = cmStrCat("IMPORTED_NO_SONAME", suffix);
if (cmValue config_no_soname = this->GetProperty(soProp)) {
info.NoSOName = cmIsOn(*config_no_soname);
info.NoSOName = config_no_soname.IsOn();
} else if (cmValue no_soname = this->GetProperty("IMPORTED_NO_SONAME")) {
info.NoSOName = cmIsOn(*no_soname);
info.NoSOName = no_soname.IsOn();
}
}

View File

@ -593,7 +593,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
for (auto& sg : groupFilesList) {
std::ostream* fout;
bool useProjectFile =
cmIsOn(this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE")) ||
this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE").IsOn() ||
this->Makefile->IsOn("CMAKE_GHS_NO_SOURCE_GROUP_FILE");
if (useProjectFile || sg.empty()) {
fout = &fout_proj;
@ -764,7 +764,7 @@ std::string cmGhsMultiTargetGenerator::WriteObjectLangOverride(
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
{
if (cmValue p = this->GeneratorTarget->GetProperty("ghs_integrity_app")) {
return cmIsOn(*p);
return p.IsOn();
}
std::vector<cmSourceFile*> sources;
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);

View File

@ -223,7 +223,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(
if (cmIsOff(makeProgram)) {
cmValue makeProgramCSTR =
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
if (cmIsOff(makeProgramCSTR)) {
if (makeProgramCSTR.IsOff()) {
makeProgram = makeDefault;
} else {
makeProgram = *makeProgramCSTR;
@ -336,7 +336,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
for (const auto& localGen : this->LocalGenerators) {
for (const auto& target : localGen->GetGeneratorTargets()) {
if (!target->CanCompileSources() ||
cmIsOn(target->GetProperty("ghs_integrity_app"))) {
target->GetProperty("ghs_integrity_app").IsOn()) {
continue;
}
@ -408,7 +408,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
for (const auto& generator : this->LocalGenerators) {
for (const auto& target : generator->GetGeneratorTargets()) {
if (!target->CanCompileSources() ||
cmIsOn(target->GetProperty("ghs_integrity_app"))) {
target->GetProperty("ghs_integrity_app").IsOn()) {
continue;
}
@ -452,13 +452,13 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
"all generators must specify this->FindMakeProgramFile");
return false;
}
if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile);
if (!setMakeProgram.empty()) {
mf->ReadListFile(setMakeProgram);
}
}
if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
std::ostringstream err;
err << "CMake was unable to find a build program corresponding to \""
<< this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
@ -2823,7 +2823,7 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
} else {
cmValue noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
if (cmIsOff(noPackageAll)) {
if (noPackageAll.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@ -2891,7 +2891,7 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
// by default. Enable it only if CMAKE_SKIP_TEST_ALL_DEPENDENCY is
// explicitly set to OFF.
if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) {
if (cmIsOff(noall)) {
if (noall.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@ -3015,7 +3015,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
cmValue noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
if (cmIsOff(noall)) {
if (noall.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@ -3097,7 +3097,7 @@ bool cmGlobalGenerator::UseFolderProperty() const
// If this property is defined, let the setter turn this on or off.
if (prop) {
return cmIsOn(*prop);
return prop.IsOn();
}
// If CMP0143 is NEW `treat` "USE_FOLDERS" as ON. Otherwise `treat` it as OFF

View File

@ -124,7 +124,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
{
/* set primary target */
cmValue t = mf->GetDefinition("GHS_PRIMARY_TARGET");
if (cmIsOff(t)) {
if (t.IsOff()) {
/* Use the value from `-A` or use `arm` */
std::string arch = "arm";
if (!cmIsOff(p)) {
@ -297,18 +297,18 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
// Specify BSP option if supplied by user
// -- not all platforms require this entry in the project file
cmValue bspName = root->GetMakefile()->GetDefinition("GHS_BSP_NAME");
if (!cmIsOff(bspName)) {
if (!bspName.IsOff()) {
fout << " -bsp " << *bspName << '\n';
}
// Specify OS DIR if supplied by user
// -- not all platforms require this entry in the project file
cmValue osDir = root->GetMakefile()->GetDefinition("GHS_OS_DIR");
if (!cmIsOff(osDir)) {
if (!osDir.IsOff()) {
cmValue osDirOption =
root->GetMakefile()->GetDefinition("GHS_OS_DIR_OPTION");
fout << " ";
if (cmIsOff(osDirOption)) {
if (osDirOption.IsOff()) {
fout << "";
} else {
fout << *osDirOption;

View File

@ -698,7 +698,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
if (cmValue tgtMsg =
this->GetCMakeInstance()->GetState()->GetGlobalProperty(
"TARGET_MESSAGES")) {
targetMessages = cmIsOn(*tgtMsg);
targetMessages = tgtMsg.IsOn();
}
if (targetMessages) {

View File

@ -390,7 +390,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM")) {
// If the value is some off/false value, then there is NO maximum set.
if (cmIsOff(value)) {
if (value.IsOff()) {
return std::string();
}
// If the value is something else, trust that it is a valid SDK value.

View File

@ -740,7 +740,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
}
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for (std::string const& i : configs) {
if (cmIsOff(target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i))) {
if (target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i).IsOff()) {
activeConfigs.insert(i);
}
}

View File

@ -491,7 +491,7 @@ bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
// Visual Studio generators know how to lookup their build tool
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram());
}
return true;

View File

@ -269,7 +269,7 @@ bool cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
// The Xcode generator knows how to lookup its build tool
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetXcodeBuildCommand());
}
return true;
@ -4223,18 +4223,18 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects(
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
bool removeHeaders = actionsOnByDefault & RemoveHeadersOnCopyByDefault;
if (auto prop = gt->GetProperty(
if (cmValue prop = gt->GetProperty(
cmStrCat(embedPropertyName, "_REMOVE_HEADERS_ON_COPY"))) {
removeHeaders = cmIsOn(*prop);
removeHeaders = prop.IsOn();
}
if (removeHeaders) {
attrs->AddObject(this->CreateString("RemoveHeadersOnCopy"));
}
bool codeSign = actionsOnByDefault & CodeSignOnCopyByDefault;
if (auto prop =
if (cmValue prop =
gt->GetProperty(cmStrCat(embedPropertyName, "_CODE_SIGN_ON_COPY"))) {
codeSign = cmIsOn(*prop);
codeSign = prop.IsOn();
}
if (codeSign) {
attrs->AddObject(this->CreateString("CodeSignOnCopy"));
@ -5298,7 +5298,7 @@ bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
return mf->PlatformIsAppleEmbedded();
}
return cmIsOn(*epnValue);
return epnValue.IsOn();
}
bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const

View File

@ -204,7 +204,7 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
target.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
// If CUDA_RESOLVE_DEVICE_SYMBOLS has been explicitly set we need
// to honor the value no matter what it is.
return cmIsOn(*resolveDeviceSymbols);
return resolveDeviceSymbols.IsOn();
}
// Determine if we have any dependencies that require
@ -213,7 +213,7 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
target.GetLinkClosure(config);
if (cm::contains(closure->Languages, "CUDA")) {
if (cmIsOn(target.GetProperty("CUDA_SEPARABLE_COMPILATION"))) {
if (target.GetProperty("CUDA_SEPARABLE_COMPILATION").IsOn()) {
bool doDeviceLinking = false;
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY:

View File

@ -3424,7 +3424,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
const std::string mode = cmIsOn(PICValue) ? "PIE" : "NO_PIE";
std::string supported = "CMAKE_" + lang + "_LINK_" + mode + "_SUPPORTED";
if (cmIsOff(this->Makefile->GetDefinition(supported))) {
if (this->Makefile->GetDefinition(supported).IsOff()) {
return;
}

View File

@ -898,7 +898,7 @@ void cmLocalUnixMakefileGenerator3::AppendRuleDepend(
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
cmValue nodep = this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY");
if (cmIsOff(nodep)) {
if (nodep.IsOff()) {
depends.emplace_back(ruleFileName);
}
}
@ -1532,7 +1532,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
if (haveDirectoryInfo) {
// Test whether we need to force Unix paths.
if (cmValue force = mf->GetDefinition("CMAKE_FORCE_UNIX_PATHS")) {
if (!cmIsOff(force)) {
if (!force.IsOff()) {
cmSystemTools::SetForceUnixPaths(true);
}
}
@ -1784,7 +1784,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
depends.clear();
cmValue noall =
this->Makefile->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
if (cmIsOff(noall)) {
if (noall.IsOff()) {
// Drive the build before installing.
depends.emplace_back("all");
} else if (regenerate) {

View File

@ -2522,7 +2522,7 @@ void cmMakefile::ExpandVariablesCMP0019()
bool cmMakefile::IsOn(const std::string& name) const
{
return cmIsOn(this->GetDefinition(name));
return this->GetDefinition(name).IsOn();
}
bool cmMakefile::IsSet(const std::string& name) const
@ -4025,7 +4025,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
// Replace #cmakedefine instances.
if (this->cmDefineRegex.find(line)) {
cmValue def = this->GetDefinition(this->cmDefineRegex.match(2));
if (!cmIsOff(def)) {
if (!def.IsOff()) {
const std::string indentation = this->cmDefineRegex.match(1);
cmSystemTools::ReplaceString(line,
cmStrCat("#", indentation, "cmakedefine"),
@ -4043,7 +4043,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
cmStrCat("#", indentation, "cmakedefine01"),
cmStrCat("#", indentation, "define"));
output += line;
if (!cmIsOff(def)) {
if (!def.IsOff()) {
output += " 1";
} else {
output += " 0";
@ -4218,7 +4218,7 @@ cmValue cmMakefile::GetProperty(const std::string& prop, bool chain) const
bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
{
return cmIsOn(this->GetProperty(prop));
return this->GetProperty(prop).IsOn();
}
std::vector<std::string> cmMakefile::GetPropertyKeys() const
@ -4625,7 +4625,7 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) const
{
// Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting.
if (cmValue val = this->GetDefinition(var)) {
return cmIsOn(val);
return val.IsOn();
}
// Enable optional policy warnings with --debug-output, --trace,
// or --trace-expand.

View File

@ -65,7 +65,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
this->NoRuleMessages = false;
if (cmValue ruleStatus =
cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) {
this->NoRuleMessages = cmIsOff(*ruleStatus);
this->NoRuleMessages = ruleStatus.IsOff();
}
switch (this->GeneratorTarget->GetPolicyStatusCMP0113()) {
case cmPolicies::WARN:
@ -244,7 +244,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
// add custom commands to the clean rules?
bool const clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
bool const clean = this->Makefile->GetProperty("CLEAN_NO_CUSTOM").IsOff();
// First generate the object rule files. Save a list of all object
// files for this target.
@ -613,8 +613,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Use compiler to generate dependencies, if supported.
bool const compilerGenerateDeps =
this->GlobalGenerator->SupportsCompilerDependencies() &&
cmIsOn(this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_DEPENDS_USE_COMPILER")));
this->Makefile
->GetDefinition(cmStrCat("CMAKE_", lang, "_DEPENDS_USE_COMPILER"))
.IsOn();
auto const scanner = compilerGenerateDeps ? cmDependencyScannerKind::Compiler
: cmDependencyScannerKind::CMake;
@ -2082,7 +2083,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects(
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_OBJECTS";
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
if (!val->empty()) {
return cmIsOn(val);
return val.IsOn();
}
}
@ -2121,7 +2122,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_LIBRARIES";
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
if (!val->empty()) {
return cmIsOn(val);
return val.IsOn();
}
}

View File

@ -601,7 +601,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
if (this->Moc.Enabled) {
// Path prefix
if (cmIsOn(this->GenTarget->GetProperty("AUTOMOC_PATH_PREFIX"))) {
if (this->GenTarget->GetProperty("AUTOMOC_PATH_PREFIX").IsOn()) {
this->Moc.PathPrefix = true;
}
@ -657,7 +657,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
auto const& value =
this->GenTarget->GetProperty("AUTOGEN_USE_SYSTEM_INCLUDE");
if (value.IsSet()) {
if (cmIsOn(value)) {
if (value.IsOn()) {
this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
"CXX");
} else {

View File

@ -442,7 +442,7 @@ const std::string& cmSourceFile::GetSafeProperty(const std::string& prop) const
bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
{
return cmIsOn(this->GetProperty(prop));
return this->GetProperty(prop).IsOn();
}
void cmSourceFile::MarkAsGenerated()

View File

@ -88,8 +88,10 @@ struct StandardLevelComputer
cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
cmPolicies::CMP0128) };
bool const defaultExt{ cmIsOn(*makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) };
bool const defaultExt{ makefile
->GetDefinition(cmStrCat("CMAKE_", this->Language,
"_EXTENSIONS_DEFAULT"))
.IsOn() };
bool ext = true;
if (cmp0128 == cmPolicies::NEW) {
@ -97,7 +99,7 @@ struct StandardLevelComputer
}
if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
ext = cmIsOn(*extPropValue);
ext = extPropValue.IsOn();
}
std::string const type{ ext ? "EXTENSION" : "STANDARD" };
@ -252,8 +254,10 @@ struct StandardLevelComputer
cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
cmPolicies::CMP0128) };
bool const defaultExt{ cmIsOn(*makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) };
bool const defaultExt{ makefile
->GetDefinition(cmStrCat("CMAKE_", this->Language,
"_EXTENSIONS_DEFAULT"))
.IsOn() };
bool ext = true;
if (cmp0128 == cmPolicies::NEW) {
@ -261,7 +265,7 @@ struct StandardLevelComputer
}
if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
ext = cmIsOn(*extPropValue);
ext = extPropValue.IsOn();
}
std::string const type{ ext ? "EXTENSION" : "STANDARD" };

View File

@ -662,7 +662,7 @@ cmValue cmState::GetGlobalProperty(const std::string& prop)
bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
{
return cmIsOn(this->GetGlobalProperty(prop));
return this->GetGlobalProperty(prop).IsOn();
}
void cmState::SetSourceDirectory(std::string const& sourceDirectory)

View File

@ -451,7 +451,7 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop,
bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const
{
return cmIsOn(this->GetProperty(prop));
return this->GetProperty(prop).IsOn();
}
std::vector<std::string> cmStateDirectory::GetPropertyKeys() const

View File

@ -2151,7 +2151,7 @@ void cmTarget::SetProperty(const std::string& prop, cmValue value)
}
if (prop == propIMPORTED_GLOBAL) {
if (!cmIsOn(value)) {
if (!value.IsOn()) {
std::ostringstream e;
e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\""
<< this->impl->Name << "\")\n";
@ -2845,7 +2845,7 @@ std::string const& cmTarget::GetSafeProperty(std::string const& prop) const
bool cmTarget::GetPropertyAsBool(const std::string& prop) const
{
return cmIsOn(this->GetProperty(prop));
return this->GetProperty(prop).IsOn();
}
cmPropertyMap const& cmTarget::GetProperties() const

View File

@ -50,7 +50,7 @@ cmValue cmTest::GetProperty(const std::string& prop) const
bool cmTest::GetPropertyAsBool(const std::string& prop) const
{
return cmIsOn(this->GetProperty(prop));
return this->GetProperty(prop).IsOn();
}
void cmTest::SetProperty(const std::string& prop, cmValue value)

View File

@ -1167,7 +1167,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference(
const char* privateReference = "True";
if (cmValue value = this->GeneratorTarget->GetProperty(
"VS_DOTNET_REFERENCES_COPY_LOCAL")) {
if (cmIsOff(*value)) {
if (value.IsOff()) {
privateReference = "False";
}
}
@ -4217,9 +4217,9 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions(
if (dpiAware) {
if (*dpiAware == "PerMonitor"_s) {
e2.Element("EnableDpiAwareness", "PerMonitorHighDPIAware");
} else if (cmIsOn(*dpiAware)) {
} else if (dpiAware.IsOn()) {
e2.Element("EnableDpiAwareness", "true");
} else if (cmIsOff(*dpiAware)) {
} else if (dpiAware.IsOff()) {
e2.Element("EnableDpiAwareness", "false");
} else {
cmSystemTools::Error(

View File

@ -369,7 +369,7 @@ bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
bool defaultValue)
{
cmValue property = Target->GetTarget()->GetProperty(varName);
bool isOn = (!property && defaultValue) || cmIsOn(property);
bool isOn = (!property && defaultValue) || property.IsOn();
if (isOn) {
xout.Attribute(attrName.c_str(), "YES");

View File

@ -2346,16 +2346,16 @@ int cmake::Configure()
// so we cannot rely on command line options alone. Always ensure our
// messenger is in sync with the cache.
cmValue value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
this->Messenger->SetSuppressDeprecatedWarnings(value && cmIsOff(*value));
this->Messenger->SetSuppressDeprecatedWarnings(value && value.IsOff());
value = this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
this->Messenger->SetDeprecatedWarningsAsErrors(cmIsOn(value));
this->Messenger->SetDeprecatedWarningsAsErrors(value.IsOn());
value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
this->Messenger->SetSuppressDevWarnings(cmIsOn(value));
this->Messenger->SetSuppressDevWarnings(value.IsOn());
value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(*value));
this->Messenger->SetDevWarningsAsErrors(value && value.IsOff());
int ret = this->ActualConfigure();
cmValue delCacheVars =
@ -2924,13 +2924,13 @@ void cmake::AddCacheEntry(const std::string& key, cmValue value,
this->UnwatchUnusedCli(key);
if (key == "CMAKE_WARN_DEPRECATED"_s) {
this->Messenger->SetSuppressDeprecatedWarnings(value && cmIsOff(value));
this->Messenger->SetSuppressDeprecatedWarnings(value && value.IsOff());
} else if (key == "CMAKE_ERROR_DEPRECATED"_s) {
this->Messenger->SetDeprecatedWarningsAsErrors(cmIsOn(value));
this->Messenger->SetDeprecatedWarningsAsErrors(value.IsOn());
} else if (key == "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"_s) {
this->Messenger->SetSuppressDevWarnings(cmIsOn(value));
this->Messenger->SetSuppressDevWarnings(value.IsOn());
} else if (key == "CMAKE_SUPPRESS_DEVELOPER_ERRORS"_s) {
this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(value));
this->Messenger->SetDevWarningsAsErrors(value && value.IsOff());
}
}
@ -3769,7 +3769,7 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
}
projName = *cachedProjectName;
if (cmIsOn(this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"))) {
if (this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE").IsOn()) {
verbose = true;
}