CMakePresets.json: Rework how --preset argument is handled

If a path argument with no -S or -B leads to a cache directory,
use that directory as the binary directory. Otherwise, use the
binary directory from the preset.

Fixes: #21311
This commit is contained in:
Kyle Edwards
2020-10-23 12:37:06 -04:00
committed by Craig Scott
parent f2a59d400e
commit b7d7eca66d
15 changed files with 65 additions and 32 deletions

View File

@@ -66,6 +66,9 @@ public:
//! Print the cache to a stream
void PrintCache(std::ostream&) const;
//! Get whether or not cache is loaded
bool IsCacheLoaded() const { return this->CacheLoaded; }
//! Get a value from the cache given a key
cmProp GetInitializedCacheValue(const std::string& key) const;
@@ -204,6 +207,7 @@ private:
const CacheEntry& e, cmMessenger* messenger) const;
std::map<std::string, CacheEntry> Cache;
bool CacheLoaded = false;
// Cache version info
unsigned int CacheMajorVersion = 0;