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")) { if (cmValue ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
this->OnlineOnly = cmIsOn(ifwDownloadAll); this->OnlineOnly = ifwDownloadAll.IsOn();
} else if (cmValue cpackDownloadAll = } else if (cmValue cpackDownloadAll =
this->GetOption("CPACK_DOWNLOAD_ALL")) { this->GetOption("CPACK_DOWNLOAD_ALL")) {
this->OnlineOnly = cmIsOn(cpackDownloadAll); this->OnlineOnly = cpackDownloadAll.IsOn();
} else { } else {
this->OnlineOnly = false; this->OnlineOnly = false;
} }

View File

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

View File

@ -527,7 +527,7 @@ cmCPackDebGenerator::~cmCPackDebGenerator() = default;
int cmCPackDebGenerator::InitializeInternal() int cmCPackDebGenerator::InitializeInternal()
{ {
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); 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"); this->SetOption("CPACK_SET_DESTDIR", "I_ON");
} }
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
switch (state->GetCacheEntryType(key)) { switch (state->GetCacheEntryType(key)) {
case cmStateEnums::BOOL: { case cmStateEnums::BOOL: {
auto bw = cm::make_unique<cmCursesBoolWidget>(this->EntryWidth, 1, 1, 1); auto bw = cm::make_unique<cmCursesBoolWidget>(this->EntryWidth, 1, 1, 1);
bw->SetValueAsBool(cmIsOn(*value)); bw->SetValueAsBool(value.IsOn());
this->Entry = std::move(bw); this->Entry = std::move(bw);
break; 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, // Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library. // otherwise it defaults to static library.
cmStateEnums::TargetType type = cmStateEnums::SHARED_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; type = cmStateEnums::STATIC_LIBRARY;
} }
bool excludeFromAll = false; bool excludeFromAll = false;

View File

@ -577,7 +577,7 @@ cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
bool cmCacheManager::CacheEntry::GetPropertyAsBool( bool cmCacheManager::CacheEntry::GetPropertyAsBool(
const std::string& prop) const const std::string& prop) const
{ {
return cmIsOn(this->GetProperty(prop)); return this->GetProperty(prop).IsOn();
} }
void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, 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 (this->GeneratorTarget->IsAIX()) {
if (cmValue exportAll = if (cmValue exportAll =
this->GeneratorTarget->GetProperty("AIX_EXPORT_ALL_SYMBOLS")) { this->GeneratorTarget->GetProperty("AIX_EXPORT_ALL_SYMBOLS")) {
if (cmIsOff(*exportAll)) { if (exportAll.IsOff()) {
aixExports = "-n"; aixExports = "-n";
} }
} }

View File

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

View File

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

View File

@ -399,7 +399,7 @@ bool cmConditionEvaluator::GetBooleanValue(
// Check definition. // Check definition.
cmValue def = this->GetDefinitionIfUnquoted(arg); cmValue def = this->GetDefinitionIfUnquoted(arg);
return !cmIsOff(def); return !def.IsOff();
} }
//========================================================================= //=========================================================================
@ -416,14 +416,14 @@ bool cmConditionEvaluator::GetBooleanValueOld(
return true; return true;
} }
cmValue def = this->GetDefinitionIfUnquoted(arg); cmValue def = this->GetDefinitionIfUnquoted(arg);
return !cmIsOff(def); return !def.IsOff();
} }
// Old GetVariableOrNumber behavior. // Old GetVariableOrNumber behavior.
cmValue def = this->GetDefinitionIfUnquoted(arg); cmValue def = this->GetDefinitionIfUnquoted(arg);
if (!def && std::atoi(arg.GetValue().c_str())) { if (!def && std::atoi(arg.GetValue().c_str())) {
def = cmValue(arg.GetValue()); 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) { for (auto const& path : search_paths) {
cmValue def = this->Makefile->GetDefinition(path.second); cmValue def = this->Makefile->GetDefinition(path.second);
if (def) { 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 // priority over the deprecated CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
if (cmValue const def = if (cmValue const def =
this->Makefile->GetDefinition("CMAKE_FIND_USE_PACKAGE_REGISTRY")) { 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")) { } else if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
this->NoUserRegistry = true; 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 // priority over the deprecated CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
if (cmValue const def = this->Makefile->GetDefinition( if (cmValue const def = this->Makefile->GetDefinition(
"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY")) { "CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY")) {
this->NoSystemRegistry = !cmIsOn(*def); this->NoSystemRegistry = !def.IsOn();
} else if (this->Makefile->IsOn( } else if (this->Makefile->IsOn(
"CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY")) { "CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY")) {
this->NoSystemRegistry = true; this->NoSystemRegistry = true;
@ -1420,7 +1420,7 @@ bool cmFindPackageCommand::HandlePackageMode(
// Try to load the config file if the directory is known // Try to load the config file if the directory is known
bool fileFound = false; bool fileFound = false;
if (this->UseConfigFiles) { if (this->UseConfigFiles) {
if (!cmIsOff(def)) { if (!def.IsOff()) {
// Get the directory from the variable value. // Get the directory from the variable value.
std::string dir = *def; std::string dir = *def;
cmSystemTools::ConvertToUnixSlashes(dir); cmSystemTools::ConvertToUnixSlashes(dir);
@ -1440,7 +1440,7 @@ bool cmFindPackageCommand::HandlePackageMode(
} }
// Search for the config file if it is not already found. // Search for the config file if it is not already found.
if (cmIsOff(def) || !fileFound) { if (def.IsOff() || !fileFound) {
fileFound = this->FindConfig(); fileFound = this->FindConfig();
} }

View File

@ -918,7 +918,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
{ {
cmValue feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config); cmValue feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config);
if (!cmIsOn(feature)) { if (!feature.IsOn()) {
// 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies // 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies
return false; return false;
} }
@ -1084,8 +1084,8 @@ cmValue cmGeneratorTarget::GetLanguageExtensions(std::string const& lang) const
bool cmGeneratorTarget::GetLanguageStandardRequired( bool cmGeneratorTarget::GetLanguageStandardRequired(
std::string const& lang) const std::string const& lang) const
{ {
return cmIsOn( return this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED")
this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED")); .IsOn();
} }
void cmGeneratorTarget::GetModuleDefinitionSources( void cmGeneratorTarget::GetModuleDefinitionSources(
@ -2422,7 +2422,7 @@ bool cmGeneratorTarget::MacOSXUseInstallNameDir() const
cmValue build_with_install_name = cmValue build_with_install_name =
this->GetProperty("BUILD_WITH_INSTALL_NAME_DIR"); this->GetProperty("BUILD_WITH_INSTALL_NAME_DIR");
if (build_with_install_name) { if (build_with_install_name) {
return cmIsOn(*build_with_install_name); return build_with_install_name.IsOn();
} }
cmPolicies::PolicyStatus cmp0068 = this->GetPolicyStatusCMP0068(); cmPolicies::PolicyStatus cmp0068 = this->GetPolicyStatusCMP0068();
@ -6768,7 +6768,7 @@ bool cmGeneratorTarget::IsFortranBuildingInstrinsicModules() const
{ {
if (cmValue prop = if (cmValue prop =
this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) { this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) {
return cmIsOn(*prop); return prop.IsOn();
} }
return false; return false;
} }
@ -7881,9 +7881,9 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
if (this->GetType() == cmStateEnums::SHARED_LIBRARY) { if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = cmStrCat("IMPORTED_NO_SONAME", suffix); std::string soProp = cmStrCat("IMPORTED_NO_SONAME", suffix);
if (cmValue config_no_soname = this->GetProperty(soProp)) { 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")) { } 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) { for (auto& sg : groupFilesList) {
std::ostream* fout; std::ostream* fout;
bool useProjectFile = 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"); this->Makefile->IsOn("CMAKE_GHS_NO_SOURCE_GROUP_FILE");
if (useProjectFile || sg.empty()) { if (useProjectFile || sg.empty()) {
fout = &fout_proj; fout = &fout_proj;
@ -764,7 +764,7 @@ std::string cmGhsMultiTargetGenerator::WriteObjectLangOverride(
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp() bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
{ {
if (cmValue p = this->GeneratorTarget->GetProperty("ghs_integrity_app")) { if (cmValue p = this->GeneratorTarget->GetProperty("ghs_integrity_app")) {
return cmIsOn(*p); return p.IsOn();
} }
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName); this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);

View File

@ -223,7 +223,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(
if (cmIsOff(makeProgram)) { if (cmIsOff(makeProgram)) {
cmValue makeProgramCSTR = cmValue makeProgramCSTR =
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
if (cmIsOff(makeProgramCSTR)) { if (makeProgramCSTR.IsOff()) {
makeProgram = makeDefault; makeProgram = makeDefault;
} else { } else {
makeProgram = *makeProgramCSTR; makeProgram = *makeProgramCSTR;
@ -336,7 +336,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
for (const auto& localGen : this->LocalGenerators) { for (const auto& localGen : this->LocalGenerators) {
for (const auto& target : localGen->GetGeneratorTargets()) { for (const auto& target : localGen->GetGeneratorTargets()) {
if (!target->CanCompileSources() || if (!target->CanCompileSources() ||
cmIsOn(target->GetProperty("ghs_integrity_app"))) { target->GetProperty("ghs_integrity_app").IsOn()) {
continue; continue;
} }
@ -408,7 +408,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
for (const auto& generator : this->LocalGenerators) { for (const auto& generator : this->LocalGenerators) {
for (const auto& target : generator->GetGeneratorTargets()) { for (const auto& target : generator->GetGeneratorTargets()) {
if (!target->CanCompileSources() || if (!target->CanCompileSources() ||
cmIsOn(target->GetProperty("ghs_integrity_app"))) { target->GetProperty("ghs_integrity_app").IsOn()) {
continue; continue;
} }
@ -452,13 +452,13 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
"all generators must specify this->FindMakeProgramFile"); "all generators must specify this->FindMakeProgramFile");
return false; return false;
} }
if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile); std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile);
if (!setMakeProgram.empty()) { if (!setMakeProgram.empty()) {
mf->ReadListFile(setMakeProgram); mf->ReadListFile(setMakeProgram);
} }
} }
if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
std::ostringstream err; std::ostringstream err;
err << "CMake was unable to find a build program corresponding to \"" err << "CMake was unable to find a build program corresponding to \""
<< this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You " << this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
@ -2823,7 +2823,7 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
} else { } else {
cmValue noPackageAll = cmValue noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY"); mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
if (cmIsOff(noPackageAll)) { if (noPackageAll.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName()); 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 // by default. Enable it only if CMAKE_SKIP_TEST_ALL_DEPENDENCY is
// explicitly set to OFF. // explicitly set to OFF.
if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) { if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) {
if (cmIsOff(noall)) { if (noall.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName()); gti.Depends.emplace_back(this->GetAllTargetName());
} }
} }
@ -3015,7 +3015,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
gti.Depends.emplace_back(this->GetPreinstallTargetName()); gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else { } else {
cmValue noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); cmValue noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
if (cmIsOff(noall)) { if (noall.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName()); 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 this property is defined, let the setter turn this on or off.
if (prop) { if (prop) {
return cmIsOn(*prop); return prop.IsOn();
} }
// If CMP0143 is NEW `treat` "USE_FOLDERS" as ON. Otherwise `treat` it as OFF // 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 */ /* set primary target */
cmValue t = mf->GetDefinition("GHS_PRIMARY_TARGET"); cmValue t = mf->GetDefinition("GHS_PRIMARY_TARGET");
if (cmIsOff(t)) { if (t.IsOff()) {
/* Use the value from `-A` or use `arm` */ /* Use the value from `-A` or use `arm` */
std::string arch = "arm"; std::string arch = "arm";
if (!cmIsOff(p)) { if (!cmIsOff(p)) {
@ -297,18 +297,18 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
// Specify BSP option if supplied by user // Specify BSP option if supplied by user
// -- not all platforms require this entry in the project file // -- not all platforms require this entry in the project file
cmValue bspName = root->GetMakefile()->GetDefinition("GHS_BSP_NAME"); cmValue bspName = root->GetMakefile()->GetDefinition("GHS_BSP_NAME");
if (!cmIsOff(bspName)) { if (!bspName.IsOff()) {
fout << " -bsp " << *bspName << '\n'; fout << " -bsp " << *bspName << '\n';
} }
// Specify OS DIR if supplied by user // Specify OS DIR if supplied by user
// -- not all platforms require this entry in the project file // -- not all platforms require this entry in the project file
cmValue osDir = root->GetMakefile()->GetDefinition("GHS_OS_DIR"); cmValue osDir = root->GetMakefile()->GetDefinition("GHS_OS_DIR");
if (!cmIsOff(osDir)) { if (!osDir.IsOff()) {
cmValue osDirOption = cmValue osDirOption =
root->GetMakefile()->GetDefinition("GHS_OS_DIR_OPTION"); root->GetMakefile()->GetDefinition("GHS_OS_DIR_OPTION");
fout << " "; fout << " ";
if (cmIsOff(osDirOption)) { if (osDirOption.IsOff()) {
fout << ""; fout << "";
} else { } else {
fout << *osDirOption; fout << *osDirOption;

View File

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

View File

@ -390,7 +390,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM")) { "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM")) {
// If the value is some off/false value, then there is NO maximum set. // If the value is some off/false value, then there is NO maximum set.
if (cmIsOff(value)) { if (value.IsOff()) {
return std::string(); return std::string();
} }
// If the value is something else, trust that it is a valid SDK value. // 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 // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for (std::string const& i : configs) { 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); activeConfigs.insert(i);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -601,7 +601,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
if (this->Moc.Enabled) { if (this->Moc.Enabled) {
// Path prefix // Path prefix
if (cmIsOn(this->GenTarget->GetProperty("AUTOMOC_PATH_PREFIX"))) { if (this->GenTarget->GetProperty("AUTOMOC_PATH_PREFIX").IsOn()) {
this->Moc.PathPrefix = true; this->Moc.PathPrefix = true;
} }
@ -657,7 +657,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
auto const& value = auto const& value =
this->GenTarget->GetProperty("AUTOGEN_USE_SYSTEM_INCLUDE"); this->GenTarget->GetProperty("AUTOGEN_USE_SYSTEM_INCLUDE");
if (value.IsSet()) { if (value.IsSet()) {
if (cmIsOn(value)) { if (value.IsOn()) {
this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp, this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
"CXX"); "CXX");
} else { } 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 bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
{ {
return cmIsOn(this->GetProperty(prop)); return this->GetProperty(prop).IsOn();
} }
void cmSourceFile::MarkAsGenerated() void cmSourceFile::MarkAsGenerated()

View File

@ -88,8 +88,10 @@ struct StandardLevelComputer
cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus( cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
cmPolicies::CMP0128) }; cmPolicies::CMP0128) };
bool const defaultExt{ cmIsOn(*makefile->GetDefinition( bool const defaultExt{ makefile
cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) }; ->GetDefinition(cmStrCat("CMAKE_", this->Language,
"_EXTENSIONS_DEFAULT"))
.IsOn() };
bool ext = true; bool ext = true;
if (cmp0128 == cmPolicies::NEW) { if (cmp0128 == cmPolicies::NEW) {
@ -97,7 +99,7 @@ struct StandardLevelComputer
} }
if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) { if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
ext = cmIsOn(*extPropValue); ext = extPropValue.IsOn();
} }
std::string const type{ ext ? "EXTENSION" : "STANDARD" }; std::string const type{ ext ? "EXTENSION" : "STANDARD" };
@ -252,8 +254,10 @@ struct StandardLevelComputer
cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus( cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
cmPolicies::CMP0128) }; cmPolicies::CMP0128) };
bool const defaultExt{ cmIsOn(*makefile->GetDefinition( bool const defaultExt{ makefile
cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) }; ->GetDefinition(cmStrCat("CMAKE_", this->Language,
"_EXTENSIONS_DEFAULT"))
.IsOn() };
bool ext = true; bool ext = true;
if (cmp0128 == cmPolicies::NEW) { if (cmp0128 == cmPolicies::NEW) {
@ -261,7 +265,7 @@ struct StandardLevelComputer
} }
if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) { if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
ext = cmIsOn(*extPropValue); ext = extPropValue.IsOn();
} }
std::string const type{ ext ? "EXTENSION" : "STANDARD" }; 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) bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
{ {
return cmIsOn(this->GetGlobalProperty(prop)); return this->GetGlobalProperty(prop).IsOn();
} }
void cmState::SetSourceDirectory(std::string const& sourceDirectory) 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 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 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 (prop == propIMPORTED_GLOBAL) {
if (!cmIsOn(value)) { if (!value.IsOn()) {
std::ostringstream e; std::ostringstream e;
e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\"" e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\""
<< this->impl->Name << "\")\n"; << 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 bool cmTarget::GetPropertyAsBool(const std::string& prop) const
{ {
return cmIsOn(this->GetProperty(prop)); return this->GetProperty(prop).IsOn();
} }
cmPropertyMap const& cmTarget::GetProperties() const 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 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) void cmTest::SetProperty(const std::string& prop, cmValue value)

View File

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

View File

@ -369,7 +369,7 @@ bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
bool defaultValue) bool defaultValue)
{ {
cmValue property = Target->GetTarget()->GetProperty(varName); cmValue property = Target->GetTarget()->GetProperty(varName);
bool isOn = (!property && defaultValue) || cmIsOn(property); bool isOn = (!property && defaultValue) || property.IsOn();
if (isOn) { if (isOn) {
xout.Attribute(attrName.c_str(), "YES"); 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 // so we cannot rely on command line options alone. Always ensure our
// messenger is in sync with the cache. // messenger is in sync with the cache.
cmValue value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); 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"); 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"); 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"); value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(*value)); this->Messenger->SetDevWarningsAsErrors(value && value.IsOff());
int ret = this->ActualConfigure(); int ret = this->ActualConfigure();
cmValue delCacheVars = cmValue delCacheVars =
@ -2924,13 +2924,13 @@ void cmake::AddCacheEntry(const std::string& key, cmValue value,
this->UnwatchUnusedCli(key); this->UnwatchUnusedCli(key);
if (key == "CMAKE_WARN_DEPRECATED"_s) { 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) { } 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) { } 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) { } 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; projName = *cachedProjectName;
if (cmIsOn(this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"))) { if (this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE").IsOn()) {
verbose = true; verbose = true;
} }