diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-10-27 11:33:37 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-27 11:33:46 (GMT) |
commit | 105ef112c990df78869a37f0b045087d3b0c900f (patch) | |
tree | 54985ff89210bbd426cde0228d1d62e25c355d4f /Source | |
parent | c79e02c4c3acb16d81d1b940074853f653634546 (diff) | |
parent | b7d7eca66db97f9dcb6068762733f06941c0c05a (diff) | |
download | CMake-105ef112c990df78869a37f0b045087d3b0c900f.zip CMake-105ef112c990df78869a37f0b045087d3b0c900f.tar.gz CMake-105ef112c990df78869a37f0b045087d3b0c900f.tar.bz2 |
Merge topic 'cmake-presets-path-arg'
b7d7eca66d CMakePresets.json: Rework how --preset argument is handled
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5416
Diffstat (limited to 'Source')
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 3 | ||||
-rw-r--r-- | Source/cmCacheManager.cxx | 1 | ||||
-rw-r--r-- | Source/cmCacheManager.h | 4 | ||||
-rw-r--r-- | Source/cmState.cxx | 5 | ||||
-rw-r--r-- | Source/cmState.h | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 4 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 3 |
7 files changed, 17 insertions, 5 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index a5b2f34..182c23d 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -32,8 +32,7 @@ static const char* cmDocumentationUsage[][2] = { " cmake-gui [options]\n" " cmake-gui [options] <path-to-source>\n" " cmake-gui [options] <path-to-existing-build>\n" - " cmake-gui [options] -S <path-to-source> -B <path-to-build>\n" - " cmake-gui [options] -S <path-to-source> --preset=<preset-name>\n" }, + " cmake-gui [options] -S <path-to-source> -B <path-to-build>\n" }, { nullptr, nullptr } }; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 95686ea..8d1a5fd 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -162,6 +162,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, cmSystemTools::Error(message.str()); } } + this->CacheLoaded = true; return true; } diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 20d49a8..9aebffc 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -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; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 77665f1..3692a01 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -135,6 +135,11 @@ bool cmState::DeleteCache(const std::string& path) return this->CacheManager->DeleteCache(path); } +bool cmState::IsCacheLoaded() const +{ + return this->CacheManager->IsCacheLoaded(); +} + std::vector<std::string> cmState::GetCacheEntryKeys() const { return this->CacheManager->GetCacheEntryKeys(); diff --git a/Source/cmState.h b/Source/cmState.h index 0744f64..4e41156 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -89,6 +89,8 @@ public: bool DeleteCache(const std::string& path); + bool IsCacheLoaded() const; + std::vector<std::string> GetCacheEntryKeys() const; cmProp GetCacheEntryValue(std::string const& key) const; std::string GetSafeCacheEntryValue(std::string const& key) const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index de3025b..7a9e493 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -727,6 +727,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) { bool haveToolset = false; bool havePlatform = false; + bool haveBArg = false; #if !defined(CMAKE_BOOTSTRAP) std::string profilingFormat; std::string profilingOutput; @@ -775,6 +776,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) path = cmSystemTools::CollapseFullPath(path); cmSystemTools::ConvertToUnixSlashes(path); this->SetHomeOutputDirectory(path); + haveBArg = true; } else if ((i < args.size() - 2) && cmHasLiteralPrefix(arg, "--check-build-system")) { this->CheckBuildSystemArgument = args[++i]; @@ -1057,7 +1059,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) return; } - if (!haveBinaryDir) { + if (!this->State->IsCacheLoaded() && !haveBArg) { this->SetHomeOutputDirectory(expandedPreset->BinaryDir); } if (!this->GlobalGenerator) { diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index f570337..f0963c2 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -49,8 +49,7 @@ const char* cmDocumentationUsage[][2] = { { nullptr, " cmake [options] <path-to-source>\n" " cmake [options] <path-to-existing-build>\n" - " cmake [options] -S <path-to-source> -B <path-to-build>\n" - " cmake [options] -S <path-to-source> --preset=<preset-name>" }, + " cmake [options] -S <path-to-source> -B <path-to-build>" }, { nullptr, "Specify a source directory to (re-)generate a build system for " "it in the current working directory. Specify an existing build " |