MCPcopy Create free account
hub / github.com/Kitware/CMake / HandleCacheMode

Function HandleCacheMode

Source/cmSetPropertyCommand.cxx:916–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

914}
915
916bool HandleCacheMode(cmExecutionStatus& status,
917 std::set<std::string> const& names,
918 std::string const& propertyName,
919 std::string const& propertyValue, bool appendAsString,
920 bool appendMode, bool remove)
921{
922 if (propertyName == "ADVANCED") {
923 if (!remove && !cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
924 status.SetError(cmStrCat("given non-boolean value \"", propertyValue,
925 R"(" for CACHE property "ADVANCED". )"));
926 return false;
927 }
928 } else if (propertyName == "TYPE") {
929 if (!cmState::IsCacheEntryType(propertyValue)) {
930 status.SetError(
931 cmStrCat("given invalid CACHE entry TYPE \"", propertyValue, '"'));
932 return false;
933 }
934 } else if (propertyName != "HELPSTRING" && propertyName != "STRINGS" &&
935 propertyName != "VALUE") {
936 status.SetError(
937 cmStrCat("given invalid CACHE property ", propertyName,
938 ". "
939 "Settable CACHE properties are: "
940 "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE."));
941 return false;
942 }
943
944 for (std::string const& name : names) {
945 // Get the source file.
946 cmake* cm = status.GetMakefile().GetCMakeInstance();
947 cmValue existingValue = cm->GetState()->GetCacheEntryValue(name);
948 if (existingValue) {
949 if (!HandleCacheEntry(name, status.GetMakefile(), propertyName,
950 propertyValue, appendAsString, appendMode,
951 remove)) {
952 return false;
953 }
954 } else {
955 status.SetError(cmStrCat("could not find CACHE variable ", name,
956 ". Perhaps it has not yet been created."));
957 return false;
958 }
959 }
960 return true;
961}
962
963bool HandleCacheEntry(std::string const& cacheKey, cmMakefile const& makefile,
964 std::string const& propertyName,

Callers 1

cmSetPropertyCommandFunction · 0.70

Calls 9

cmIsOnFunction · 0.85
cmIsOffFunction · 0.85
HandleCacheEntryFunction · 0.85
cmStrCatFunction · 0.70
SetErrorMethod · 0.45
GetCMakeInstanceMethod · 0.45
GetMakefileMethod · 0.45
GetCacheEntryValueMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…