summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorCarsten Rudolph <18394207+crud89@users.noreply.github.com>2022-02-15 09:25:53 (GMT)
committerBrad King <brad.king@kitware.com>2022-02-15 15:20:02 (GMT)
commitf320a31087c4efc07e7d10b621ec45dd0350c83a (patch)
tree19e38afc5f7b43c2bd54575c2b13db8996a719e4 /Source
parente5a5f3b76fd89a8e98c981012714f94a1d984ad8 (diff)
downloadCMake-f320a31087c4efc07e7d10b621ec45dd0350c83a.zip
CMake-f320a31087c4efc07e7d10b621ec45dd0350c83a.tar.gz
CMake-f320a31087c4efc07e7d10b621ec45dd0350c83a.tar.bz2
cmake --build: prioritize --resolve-package-references over preset
Fixes: #23224
Diffstat (limited to 'Source')
-rw-r--r--Source/cmBuildOptions.h18
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmake.cxx3
-rw-r--r--Source/cmakemain.cxx2
4 files changed, 13 insertions, 12 deletions
diff --git a/Source/cmBuildOptions.h b/Source/cmBuildOptions.h
index 58baeef..aa3184e 100644
--- a/Source/cmBuildOptions.h
+++ b/Source/cmBuildOptions.h
@@ -7,20 +7,20 @@
/** \brief Defines how to resolve packages **/
enum class PackageResolveMode
{
- /** \brief Defines behavior based on cache variable (e.g.
+ /** \brief Behavior is defined by preset or cache variable (e.g.
CMAKE_VS_NUGET_PACKAGE_RESTORE). This is the default. **/
- FromCacheVariable,
+ Default,
- /** \brief Ignore behavior defined by cache variable and forces packages to
- be resolved prior to build. **/
+ /** \brief Ignore behavior defined by preset or cache variable and forces
+ packages to be resolved prior to build. **/
Force,
- /** \brief Ignore behavior defined by cache variable and forces packages to
- be resolved, but skip the actual build. **/
+ /** \brief Ignore behavior defined by preset or cache variable and forces
+ packages to be resolved, but skip the actual build. **/
OnlyResolve,
- /** \brief Ignore behavior defined by cache variable and dont resolve any
- packages **/
+ /** \brief Ignore behavior defined by preset or cache variable and don't
+ resolve any packages **/
Disable
};
@@ -40,5 +40,5 @@ public:
bool Clean = false;
bool Fast = false;
- PackageResolveMode ResolveMode = PackageResolveMode::FromCacheVariable;
+ PackageResolveMode ResolveMode = PackageResolveMode::Default;
};
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index a96f6f0..db54b86 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1222,7 +1222,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
"Studio 2017 and later. You have to manually restore the "
"packages using NuGet before building the project.");
restorePackages = false;
- } else if (restoreMode == PackageResolveMode::FromCacheVariable) {
+ } else if (restoreMode == PackageResolveMode::Default) {
// Decide if a restore is performed, based on a cache variable.
if (cmValue cached =
this->CMakeInstance->GetState()->GetCacheEntryValue(
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ef4e37b..e1ba12c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3356,7 +3356,8 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
buildOptions.Clean = *expandedPreset->CleanFirst;
}
- if (expandedPreset->ResolvePackageReferences) {
+ if (buildOptions.ResolveMode == PackageResolveMode::Default &&
+ expandedPreset->ResolvePackageReferences) {
buildOptions.ResolveMode = *expandedPreset->ResolvePackageReferences;
}
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index f3d5536..0554c3e 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -447,7 +447,7 @@ int do_build(int ac, char const* const* av)
bool cleanFirst = false;
bool foundClean = false;
bool foundNonClean = false;
- PackageResolveMode resolveMode = PackageResolveMode::FromCacheVariable;
+ PackageResolveMode resolveMode = PackageResolveMode::Default;
bool verbose = cmSystemTools::HasEnv("VERBOSE");
std::string presetName;
bool listPresets = false;