[CMake] determine 32 vs 64 bit linux
Theodore Papadopoulo
Theodore.Papadopoulo at inria.fr
Thu Jun 23 03:07:51 EDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/23/2011 03:31 AM, Jean-Christophe Fillion-Robin wrote:
> Hi Karl,
>
> You could do so something like that:
>
> set(bitness 32)
> if(CMAKE_SIZEOF_VOID_P EQUAL 8)
> set(bitness 64)
> endif()
>
> The following macro provides a more complete example...
>
http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/CMake/SlicerMacroGetPlatformArchitectureBitness.cmake?view=markup
>
I think the problem is more complicated than that. The proper directory
differs from one distrib to the other (eg debian and fedora at least
with some not that old versions).
Cmake knows the proper place to look for libraries, but does not
publicize it enough. Personally I do:
# Offer the user the choice of overriding the installation directories
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if (${LIB64} STREQUAL "TRUE")
set(LIBSUFFIX 64)
else()
set(LIBSUFFIX "")
endif()
set(INSTALL_LIB_DIR lib${LIBSUFFIX}/Odyssee++ CACHE PATH
"Installation directory for libraries")
which as far as I can tell selects the proper lib dir for linux.
Theo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk4C5kYACgkQEr8WrU8nPV3yOACdF62q0MGKlBF2279TDreBxAEn
xnMAn0Xu1/o2N5KQUURuIK0JfgiiAj6U
=ghqB
-----END PGP SIGNATURE-----
More information about the CMake
mailing list