summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2020-10-27 11:33:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-10-27 11:33:45 (GMT)
commit698851cdb7e49c2705898a71b2eaf96ca70b9ad5 (patch)
treecdc361b069054bc6fea4a391e6f7dcf75dd15591 /Source
parent96ea613f169cedc4087b536d95ca6c128b8f4eb6 (diff)
parentb7d7eca66db97f9dcb6068762733f06941c0c05a (diff)
downloadCMake-698851cdb7e49c2705898a71b2eaf96ca70b9ad5.zip
CMake-698851cdb7e49c2705898a71b2eaf96ca70b9ad5.tar.gz
CMake-698851cdb7e49c2705898a71b2eaf96ca70b9ad5.tar.bz2
Merge topic 'cmake-presets-path-arg' into release-3.19
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.cxx3
-rw-r--r--Source/cmCacheManager.cxx1
-rw-r--r--Source/cmCacheManager.h4
-rw-r--r--Source/cmState.cxx5
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmake.cxx4
-rw-r--r--Source/cmakemain.cxx3
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 d5ac9ae..d268e62 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 2aa57e0..e4c9eb5 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -87,6 +87,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 45d6d6c..f4ab1b0 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 "