cmState: Move try_compile state from cmake class.

This commit is contained in:
Stephen Kelly 2015-04-11 12:16:54 +02:00
parent db8425be18
commit 62854e9966
3 changed files with 22 additions and 8 deletions

View File

@ -15,7 +15,8 @@
#include "cmCacheManager.h" #include "cmCacheManager.h"
cmState::cmState(cmake* cm) cmState::cmState(cmake* cm)
: CMakeInstance(cm) : CMakeInstance(cm),
IsInTryCompile(false)
{ {
} }
@ -263,3 +264,13 @@ void cmState::ClearEnabledLanguages()
{ {
this->EnabledLanguages.clear(); this->EnabledLanguages.clear();
} }
bool cmState::GetIsInTryCompile() const
{
return this->IsInTryCompile;
}
void cmState::SetIsInTryCompile(bool b)
{
this->IsInTryCompile = b;
}

View File

@ -76,10 +76,14 @@ public:
std::vector<std::string> GetEnabledLanguages() const; std::vector<std::string> GetEnabledLanguages() const;
void ClearEnabledLanguages(); void ClearEnabledLanguages();
bool GetIsInTryCompile() const;
void SetIsInTryCompile(bool b);
private: private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages; std::vector<std::string> EnabledLanguages;
cmake* CMakeInstance; cmake* CMakeInstance;
bool IsInTryCompile;
}; };
#endif #endif

View File

@ -151,7 +151,6 @@ cmake::cmake()
#endif #endif
this->Verbose = false; this->Verbose = false;
this->InTryCompile = false;
this->CacheManager = new cmCacheManager(this); this->CacheManager = new cmCacheManager(this);
this->GlobalGenerator = 0; this->GlobalGenerator = 0;
this->ProgressCallback = 0; this->ProgressCallback = 0;
@ -1272,7 +1271,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true); cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true);
// erase the property to avoid infinite recursion // erase the property to avoid infinite recursion
this->SetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", ""); this->SetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
if(this->GetIsInTryCompile()) if(this->State->GetIsInTryCompile())
{ {
return 0; return 0;
} }
@ -1555,7 +1554,7 @@ int cmake::ActualConfigure()
// reset any system configuration information, except for when we are // reset any system configuration information, except for when we are
// InTryCompile. With TryCompile the system info is taken from the parent's // InTryCompile. With TryCompile the system info is taken from the parent's
// info to save time // info to save time
if (!this->InTryCompile) if (!this->State->GetIsInTryCompile())
{ {
this->GlobalGenerator->ClearEnabledLanguages(); this->GlobalGenerator->ClearEnabledLanguages();
@ -1958,7 +1957,7 @@ void cmake::SetProgressCallback(ProgressCallbackType f, void *cd)
void cmake::UpdateProgress(const char *msg, float prog) void cmake::UpdateProgress(const char *msg, float prog)
{ {
if(this->ProgressCallback && !this->InTryCompile) if(this->ProgressCallback && !this->State->GetIsInTryCompile())
{ {
(*this->ProgressCallback)(msg, prog, this->ProgressCallbackClientData); (*this->ProgressCallback)(msg, prog, this->ProgressCallbackClientData);
return; return;
@ -1967,12 +1966,12 @@ void cmake::UpdateProgress(const char *msg, float prog)
bool cmake::GetIsInTryCompile() const bool cmake::GetIsInTryCompile() const
{ {
return this->InTryCompile; return this->State->GetIsInTryCompile();
} }
void cmake::SetIsInTryCompile(bool b) void cmake::SetIsInTryCompile(bool b)
{ {
this->InTryCompile = b; this->State->SetIsInTryCompile(b);
} }
void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
@ -2339,7 +2338,7 @@ const char *cmake::GetProperty(const std::string& prop,
else if ( prop == "IN_TRY_COMPILE" ) else if ( prop == "IN_TRY_COMPILE" )
{ {
this->SetProperty("IN_TRY_COMPILE", this->SetProperty("IN_TRY_COMPILE",
this->GetIsInTryCompile()? "1":"0"); this->State->GetIsInTryCompile() ? "1" : "0");
} }
else if ( prop == "ENABLED_LANGUAGES" ) else if ( prop == "ENABLED_LANGUAGES" )
{ {