diff options
author | Brad King <brad.king@kitware.com> | 2021-07-02 18:23:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-07-12 16:21:52 (GMT) |
commit | 6c440ea3ce36d4c5b1629f111f376e809c7e99b2 (patch) | |
tree | e25d3289140a86f185698631e6082ba1991c597e /Source/cmState.cxx | |
parent | 2065bd73cb6a9a3bc463c5bb0dc6877433782973 (diff) | |
download | CMake-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/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index b235abd..bdb5bda 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -26,8 +26,9 @@ #include "cmSystemTools.h" #include "cmake.h" -cmState::cmState(Mode mode) +cmState::cmState(Mode mode, ProjectKind projectKind) : StateMode(mode) + , StateProjectKind(projectKind) { this->CacheManager = cm::make_unique<cmCacheManager>(); this->GlobVerificationManager = cm::make_unique<cmGlobVerificationManager>(); @@ -382,16 +383,6 @@ void cmState::ClearEnabledLanguages() this->EnabledLanguages.clear(); } -bool cmState::GetIsInTryCompile() const -{ - return this->IsInTryCompile; -} - -void cmState::SetIsInTryCompile(bool b) -{ - this->IsInTryCompile = b; -} - bool cmState::GetIsGeneratorMultiConfig() const { return this->IsGeneratorMultiConfig; @@ -594,8 +585,9 @@ cmProp cmState::GetGlobalProperty(const std::string& prop) std::vector<std::string> commands = this->GetCommandNames(); this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";").c_str()); } else if (prop == "IN_TRY_COMPILE") { - this->SetGlobalProperty("IN_TRY_COMPILE", - this->IsInTryCompile ? "1" : "0"); + this->SetGlobalProperty( + "IN_TRY_COMPILE", + this->StateProjectKind == ProjectKind::TryCompile ? "1" : "0"); } else if (prop == "GENERATOR_IS_MULTI_CONFIG") { this->SetGlobalProperty("GENERATOR_IS_MULTI_CONFIG", this->IsGeneratorMultiConfig ? "1" : "0"); @@ -799,6 +791,11 @@ std::string cmState::ModeToString(cmState::Mode mode) return "UNKNOWN"; } +cmState::ProjectKind cmState::GetProjectKind() const +{ + return this->StateProjectKind; +} + std::string const& cmState::GetBinaryDirectory() const { return this->BinaryDirectory; |