Commit 56d1a178 authored by Brad King's avatar Brad King

Create cmMakefile::PlatformIs64Bit helper method

This method centralizes tests for whether CMAKE_SIZEOF_VOID_P is 8.
parent f9c0e139
......@@ -324,14 +324,10 @@ void cmFindCommon::AddUserPath(std::string const& p,
// it.
cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
if(const char* psize =
this->Makefile->GetDefinition("CMAKE_SIZEOF_VOID_P"))
if(this->Makefile->PlatformIs64Bit())
{
if(atoi(psize) == 8)
{
view = cmSystemTools::KeyWOW64_64;
other_view = cmSystemTools::KeyWOW64_32;
}
view = cmSystemTools::KeyWOW64_64;
other_view = cmSystemTools::KeyWOW64_32;
}
// Expand using the view of the target application.
......
......@@ -329,15 +329,11 @@ bool cmFindPackageCommand
this->DebugMode = this->Makefile->IsOn("CMAKE_FIND_DEBUG_MODE");
// Lookup whether lib64 paths should be used.
if(const char* sizeof_dptr =
this->Makefile->GetDefinition("CMAKE_SIZEOF_VOID_P"))
if(this->Makefile->PlatformIs64Bit() &&
this->Makefile->GetCMakeInstance()
->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
{
if(atoi(sizeof_dptr) == 8 &&
this->Makefile->GetCMakeInstance()
->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
{
this->UseLib64Paths = true;
}
this->UseLib64Paths = true;
}
// Find the current root path mode.
......
......@@ -2050,6 +2050,15 @@ bool cmMakefile::IsSet(const char* name) const
return true;
}
bool cmMakefile::PlatformIs64Bit() const
{
if(const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P"))
{
return atoi(sizeof_dptr) == 8;
}
return false;
}
bool cmMakefile::CanIWriteThisFile(const char* fileName)
{
if ( !this->IsOn("CMAKE_DISABLE_SOURCE_CHANGES") )
......
......@@ -588,6 +588,9 @@ public:
bool IsOn(const char* name) const;
bool IsSet(const char* name) const;
/** Return whether the target platform is 64-bit. */
bool PlatformIs64Bit() const;
/**
* Get a list of preprocessor define flags.
*/
......
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