Commit b5212c68 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

cmState: Add API for cache version.

parent 95b0d761
...@@ -51,14 +51,14 @@ void CCONV cmSetError(void *info, const char *err) ...@@ -51,14 +51,14 @@ void CCONV cmSetError(void *info, const char *err)
unsigned int CCONV cmGetCacheMajorVersion(void *arg) unsigned int CCONV cmGetCacheMajorVersion(void *arg)
{ {
cmMakefile *mf = static_cast<cmMakefile *>(arg); cmMakefile *mf = static_cast<cmMakefile *>(arg);
cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); cmState *state = mf->GetState();
return manager->GetCacheMajorVersion(); return state->GetCacheMajorVersion();
} }
unsigned int CCONV cmGetCacheMinorVersion(void *arg) unsigned int CCONV cmGetCacheMinorVersion(void *arg)
{ {
cmMakefile *mf = static_cast<cmMakefile *>(arg); cmMakefile *mf = static_cast<cmMakefile *>(arg);
cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); cmState *state = mf->GetState();
return manager->GetCacheMinorVersion(); return state->GetCacheMinorVersion();
} }
unsigned int CCONV cmGetMajorVersion(void *) unsigned int CCONV cmGetMajorVersion(void *)
......
...@@ -677,6 +677,16 @@ bool cmState::UseMSYSShell() const ...@@ -677,6 +677,16 @@ bool cmState::UseMSYSShell() const
return this->MSYSShell; return this->MSYSShell;
} }
unsigned int cmState::GetCacheMajorVersion() const
{
return this->CMakeInstance->GetCacheManager()->GetCacheMajorVersion();
}
unsigned int cmState::GetCacheMinorVersion() const
{
return this->CMakeInstance->GetCacheManager()->GetCacheMinorVersion();
}
const char* cmState::GetBinaryDirectory() const const char* cmState::GetBinaryDirectory() const
{ {
return this->BinaryDirectory.c_str(); return this->BinaryDirectory.c_str();
......
...@@ -302,6 +302,9 @@ public: ...@@ -302,6 +302,9 @@ public:
void SetMSYSShell(bool mSYSShell); void SetMSYSShell(bool mSYSShell);
bool UseMSYSShell() const; bool UseMSYSShell() const;
unsigned int GetCacheMajorVersion() const;
unsigned int GetCacheMinorVersion() const;
private: private:
friend class cmake; friend class cmake;
void AddCacheEntry(const std::string& key, const char* value, void AddCacheEntry(const std::string& key, const char* value,
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
============================================================================*/ ============================================================================*/
#include "cmUtilitySourceCommand.h" #include "cmUtilitySourceCommand.h"
#include "cmCacheManager.h"
// cmUtilitySourceCommand // cmUtilitySourceCommand
bool cmUtilitySourceCommand bool cmUtilitySourceCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
...@@ -54,13 +52,13 @@ bool cmUtilitySourceCommand ...@@ -54,13 +52,13 @@ bool cmUtilitySourceCommand
} }
else else
{ {
cmCacheManager *manager = cmState *state =
this->Makefile->GetCMakeInstance()->GetCacheManager(); this->Makefile->GetState();
haveCacheValue = (cacheValue && haveCacheValue = (cacheValue &&
(strstr(cacheValue, "(IntDir)") == 0 || (strstr(cacheValue, "(IntDir)") == 0 ||
(intDir && strcmp(intDir, "$(IntDir)") == 0)) && (intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
(manager->GetCacheMajorVersion() != 0 && (state->GetCacheMajorVersion() != 0 &&
manager->GetCacheMinorVersion() != 0 )); state->GetCacheMinorVersion() != 0 ));
} }
if(haveCacheValue) if(haveCacheValue)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment