[CMake] Properly Detecting Win64
Eric Noulard
eric.noulard at gmail.com
Mon Jan 17 13:23:53 EST 2011
2011/1/17 Michael Jackson <mike.jackson at bluequartz.net>:
> I have the following code:
>
> if ( "${CMAKE_SIZEOF_VOID_P}" EQUAL "8" )
> set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-Win64")
> elseif( "${CMAKE_SIZEOF_VOID_P}" EQUAL "4" )
> set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-Win32")
> else()
> set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-Unknown")
> endif()
>
> I properly generate VS 2008 Win64 projects. Everything builds fine. When I build the "PACKAGE" project I get a zip file with "-Unknown" in the name. This will usually configure OK the first time or so, ie, I get a Zip file name with "-Win64" but after a few more configs this seems to revert back to "Unknown". Searching the "CMakeCache.txt" file for "CMAKE_SIZEOF_VOID_P" comes up empty. Is this some sort of temporary variable?
Shouldn't be "temporary" just "not in cache".
> Do I need to store it in my own cache variable somewhere?
I don't think you should.
Looks like a bug to me, how come CMAKE_SIZEOF_VOID_P
would it be defined "sometimes" but not **always**...
need to dive into the source of this definition, may be it is not always
defined because it is "indirectly" defined in the chain of CMake processing due
to CMake cache.
By the way shouldn't you use
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
instead of
if ( "${CMAKE_SIZEOF_VOID_P}" EQUAL "8" )
from the doc I think EQUAL is for values whereas STREQUAL is for string.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list