summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-07-02 18:23:38 (GMT)
committerBrad King <brad.king@kitware.com>2021-07-12 16:21:52 (GMT)
commit6c440ea3ce36d4c5b1629f111f376e809c7e99b2 (patch)
treee25d3289140a86f185698631e6082ba1991c597e /Source/cmake.cxx
parent2065bd73cb6a9a3bc463c5bb0dc6877433782973 (diff)
downloadCMake-6c440ea3ce36d4c5b1629f111f376e809c7e99b2.zip
CMake-6c440ea3ce36d4c5b1629f111f376e809c7e99b2.tar.gz
CMake-6c440ea3ce36d4c5b1629f111f376e809c7e99b2.tar.bz2
cmake: Model normal and try-compile project kinds explicitly
Construct with the project kind instead of mutating state after construction.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index a2b2571..ab8309d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -156,13 +156,13 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
}
#endif
-cmake::cmake(Role role, cmState::Mode mode)
+cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind)
: CMakeWorkingDirectory(cmSystemTools::GetCurrentWorkingDirectory())
, FileTimeCache(cm::make_unique<cmFileTimeCache>())
#ifndef CMAKE_BOOTSTRAP
, VariableWatch(cm::make_unique<cmVariableWatch>())
#endif
- , State(cm::make_unique<cmState>(mode))
+ , State(cm::make_unique<cmState>(mode, projectKind))
, Messenger(cm::make_unique<cmMessenger>())
{
this->TraceFile.close();
@@ -1842,7 +1842,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
std::vector<std::string> argsSplit = cmExpandedList(var, true);
// erase the property to avoid infinite recursion
this->State->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
- if (this->State->GetIsInTryCompile()) {
+ if (this->GetIsInTryCompile()) {
return 0;
}
std::vector<SaveCacheEntry> saved;
@@ -2110,7 +2110,7 @@ int cmake::ActualConfigure()
// reset any system configuration information, except for when we are
// InTryCompile. With TryCompile the system info is taken from the parent's
// info to save time
- if (!this->State->GetIsInTryCompile()) {
+ if (!this->GetIsInTryCompile()) {
this->GlobalGenerator->ClearEnabledLanguages();
this->TruncateOutputLog("CMakeOutput.log");
@@ -2621,19 +2621,14 @@ void cmake::SetProgressCallback(ProgressCallbackType f)
void cmake::UpdateProgress(const std::string& msg, float prog)
{
- if (this->ProgressCallback && !this->State->GetIsInTryCompile()) {
+ if (this->ProgressCallback && !this->GetIsInTryCompile()) {
this->ProgressCallback(msg, prog);
}
}
bool cmake::GetIsInTryCompile() const
{
- return this->State->GetIsInTryCompile();
-}
-
-void cmake::SetIsInTryCompile(bool b)
-{
- this->State->SetIsInTryCompile(b);
+ return this->State->GetProjectKind() == cmState::ProjectKind::TryCompile;
}
void cmake::AppendGlobalGeneratorsDocumentation(