aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-10-23 15:59:12 -0400
committerGitHub <noreply@github.com>2022-10-23 21:59:12 +0200
commite86d23daedbe5b79b0dacaeb289875dc56b570ae (patch)
tree76ef6f290d827318c1879a12bff67cdd97fc7703 /src
parent0a82cb4072824cefc90a6ed18f5e67d541019038 (diff)
downloadminetest-e86d23daedbe5b79b0dacaeb289875dc56b570ae.tar.xz
Check sizeof(int) and sizeof(size_t)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8bf896bb1..d61757cc1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,8 +1,19 @@
project(minetest)
+INCLUDE(CheckTypeSize)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckLibraryExists)
+check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAGE CXX)
+if(SIZEOF_INT LESS 4)
+ message(FATAL_ERROR "Minetest will not work with int less than 32 bits wide.")
+endif()
+
+check_type_size(size_t SIZEOF_SIZE_T LANGUAGE CXX)
+if(SIZEOF_SIZE_T LESS 4)
+ message(FATAL_ERROR "Minetest will not work with size_t less than 32 bits wide.")
+endif()
+
# Add custom SemiDebug build mode
set(CMAKE_CXX_FLAGS_SEMIDEBUG "-O1 -g -Wall" CACHE STRING
"Flags used by the C++ compiler during semidebug builds."