cmake: detection of the targer architecture bit size

This commit is contained in:
Hugues Delorme 2015-03-03 10:27:39 +01:00
parent 819aec00d4
commit d7a4e3b1b6
2 changed files with 14 additions and 0 deletions

View File

@ -34,6 +34,8 @@ option(BUILD_WITH_LIBSTL "Build the libSTL module" ON)
file(GLOB ALL_SRC_FILES src/gmio_core/* src/gmio_core/internal/*)
set(ALL_SRC_FILES ${ALL_SRC_FILES})
math(EXPR GMIO_TARGET_ARCH_BIT_SIZE "8 * ${CMAKE_SIZEOF_VOID_P}")
if(NOT BUILD_STRICT_C90)
# Have <stdint.h> ?
check_include_files(stdint.h GMIO_HAVE_STDINT_H)

View File

@ -29,4 +29,16 @@
#cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC
#if defined(__APPLE__)
# if defined(__i386__) || defined(__ppc__)
# define GMIO_TARGET_ARCH_BIT_SIZE 32
# elif defined(__x86_64__) || defined(__ppc64__)
# define GMIO_TARGET_ARCH_BIT_SIZE 64
# else
# error "Unknown architecture!"
# endif
#else
# define GMIO_TARGET_ARCH_BIT_SIZE @GMIO_TARGET_ARCH_BIT_SIZE@
#endif
#endif /* GMIO_CONFIG_H_CMAKE */