| 914 | } |
| 915 | |
| 916 | bool 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 | |
| 963 | bool HandleCacheEntry(std::string const& cacheKey, cmMakefile const& makefile, |
| 964 | std::string const& propertyName, |
no test coverage detected
searching dependent graphs…