diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94ec6186a70b8733c78095a370eab9922ede836f..9fb6895714215c89e63fc7ba41bb566d7fb5548b 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,14 @@ set(CMAKE_ASM_FLAGS "-std=c11 -Wall -Wextra -fPIC -fno-pie -no-pie")
 
 if(NOT (${SUBMODULES_NO_BUILD} MATCHES ON))
 
+  # Check whether we're on a 32-bit or 64-bit system
+  if(CMAKE_SIZEOF_VOID_P EQUAL "8")
+    set(DEFAULT_BUILD_64 ON)
+  else()
+    set(DEFAULT_BUILD_64 OFF)
+  endif()
+  option(BUILD_64 "Build for 64-bit? 'OFF' builds for 32-bit." ${DEFAULT_BUILD_64})
+
   add_definitions ("-DDAP_SERVER")
   add_definitions ("-DNODE_NETNAME=\"kelvin\"")