diff options
author | Brad King <brad.king@kitware.com> | 2009-09-30 13:45:14 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-09-30 13:45:14 -0400 |
commit | 56d1a1780d45d8f9f852e32162153d80721b4662 (patch) | |
tree | 7035af3c8c36da7cdf398c6fc522e10f459102b8 | |
parent | f9c0e139758ed38975cce8d78420b5b5ba36bbbd (diff) | |
download | cmake-56d1a1780d45d8f9f852e32162153d80721b4662.tar.gz |
Create cmMakefile::PlatformIs64Bit helper method
This method centralizes tests for whether CMAKE_SIZEOF_VOID_P is 8.
-rw-r--r-- | Source/cmFindCommon.cxx | 10 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 9 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 |
4 files changed, 19 insertions, 15 deletions
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 70c0f73f1e..f4c00645ec 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -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. diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index e7beb84de0..165dbc2cc4 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -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. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e49ec3d985..7aa1202bc0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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") ) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ea9eb17c0c..485d9e24d9 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -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. */ |