diff --git a/CMakeLists.txt b/CMakeLists.txt index 458df0e5a07537706b7e75f9d0c6ff9f4e941cd0..0d4599b9e32355dcf91b91cde3fbea220dcae7f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,6 +137,16 @@ macro(find_all_libraries VARNAME LISTNAME SUFFIX) endif(NUM_FOUND_LIBRARIES LESS NUM_LIST) endmacro(find_all_libraries) +# check if the machine is 64 bits (this is more reliable than using +# CMAKE_SIZEOF_VOID_P, which does not seem to work e.g. on some Suse +# machines) +include(CheckTypeSize) +check_type_size("void*" SIZEOF_VOID_P) +if(SIZEOF_VOID_P EQUAL 8) + set(HAVE_64BIT_SIZE_T TRUE) + list(APPEND CONFIG_OPTIONS "Have64BitSizeT") +endif(SIZEOF_VOID_P EQUAL 8) + if(ENABLE_BLAS_LAPACK) if(MSVC) # on Windows with Visual C++ try really hard to find blas/lapack @@ -145,11 +155,11 @@ if(ENABLE_BLAS_LAPACK) # get the reference blas/lapack libs (useful for users with no # Fortran compiler and no MKL license, who can just download our # precompiled "gmsh-dep" package) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(HAVE_64BIT_SIZE_T) set(MKL_PATH em64t/lib) - else(CMAKE_SIZEOF_VOID_P EQUAL 8) + else(HAVE_64BIT_SIZE_T) set(MKL_PATH ia32/lib) - endif(CMAKE_SIZEOF_VOID_P EQUAL 8) + endif(HAVE_64BIT_SIZE_T) set(MKL_LIBS_REQUIRED libguide40 mkl_intel_c mkl_intel_thread mkl_core) find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED ${MKL_PATH}) if(LAPACK_LIBRARIES) @@ -168,11 +178,11 @@ if(ENABLE_BLAS_LAPACK) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # on Linux also try to find the Intel MKL without a Fortran # compiler - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(HAVE_64BIT_SIZE_T) set(MKL_PATH lib/em64t) - else(CMAKE_SIZEOF_VOID_P EQUAL 8) + else(HAVE_64BIT_SIZE_T) set(MKL_PATH lib/32) - endif(CMAKE_SIZEOF_VOID_P EQUAL 8) + endif(HAVE_64BIT_SIZE_T) set(MKL_LIBS_REQUIRED mkl_gf_lp64 iomp5 mkl_gnu_thread mkl_core) find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED ${MKL_PATH}) if(LAPACK_LIBRARIES) @@ -524,6 +534,9 @@ if(ENABLE_OCC) list(APPEND CONFIG_OPTIONS "OpenCascade") list(APPEND EXTERNAL_LIBRARIES ${OCC_LIBS}) list(APPEND EXTERNAL_INCLUDES ${OCC_INC}) + if(HAVE_64BIT_SIZE_T) + add_definitions(-D_OCC64) + endif(HAVE_64BIT_SIZE_T) if(CYGWIN) list(APPEND EXTERNAL_LIBRARIES "winspool") elseif(MSVC) @@ -542,14 +555,6 @@ if(ENABLE_OSMESA) endif(OSMESA_LIB) endif(ENABLE_OSMESA) -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(HAVE_64BIT_SIZE_T TRUE) - list(APPEND CONFIG_OPTIONS "Have64BitSizeT") - if(HAVE_OCC) - add_definitions(-D_OCC64) - endif(HAVE_OCC) -endif(CMAKE_SIZEOF_VOID_P EQUAL 8) - include(CheckFunctionExists) check_function_exists(vsnprintf HAVE_VSNPRINTF) if(NOT HAVE_VSNPRINTF)