From b57a230f335c4590f0ce6531102e814dc0eb1d83 Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Wed, 6 Aug 2014 15:07:00 +0200 Subject: [PATCH] Detect 64-bit, and set WIN64 for windows --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 624e1d7..d597a5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,13 @@ set( tidy_DAY 03 ) set( LIB_TYPE STATIC ) # set default static option( BUILD_SHARED_LIB "Build Shared Library" OFF ) +if (CMAKE_SIZEOF_VOID_P EQUAL 8) + message(STATUS "*** Have SIZEOF void * = 8, so 64-bit") + set( IS_64_BIT 1 ) +else () + message(STATUS "*** SIZEOF void * != 8, so not 64-bit") +endif () + # to distinguish between debug and release lib in windows if (WIN32) set( CMAKE_DEBUG_POSTFIX "d" ) # little effect in unix @@ -43,6 +50,9 @@ if(WIN32 AND MSVC) endforeach() set( MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS" ) + if (IS_64_BIT) + set( MSVC_FLAGS "${MSVC_FLAGS} -DWIN64" ) + endif () # if (${MSVC_VERSION} EQUAL 1600) # set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" ) # endif (${MSVC_VERSION} EQUAL 1600)