cmake: Allow integers for SDL_ASSERTIONS + fix -DSDL_ASSERTIONS=0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e65c3bb..3435f03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -517,15 +517,18 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
-if(SDL_ASSERTIONS STREQUAL "auto")
+set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1)
+if(SDL_ASSERTIONS MATCHES "^(auto|)$")
# Do nada - use optimization settings to determine the assertion level
-elseif(SDL_ASSERTIONS STREQUAL "disabled")
+ set(SDL_DEFAULT_ASSERT_LEVEL )
+ set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 0)
+elseif(SDL_ASSERTIONS MATCHES "^(disabled|0)$")
set(SDL_DEFAULT_ASSERT_LEVEL 0)
-elseif(SDL_ASSERTIONS STREQUAL "release")
+elseif(SDL_ASSERTIONS MATCHES "^(release|1)$")
set(SDL_DEFAULT_ASSERT_LEVEL 1)
-elseif(SDL_ASSERTIONS STREQUAL "enabled")
+elseif(SDL_ASSERTIONS MATCHES "^(enabled|2)$")
set(SDL_DEFAULT_ASSERT_LEVEL 2)
-elseif(SDL_ASSERTIONS STREQUAL "paranoid")
+elseif(SDL_ASSERTIONS MATCHES "^(paranoid|3)$")
set(SDL_DEFAULT_ASSERT_LEVEL 3)
else()
message_error("unknown assertion level")
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 3f17d13..c213a2f 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -261,7 +261,9 @@
#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
/* SDL internal assertion support */
+#if @SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED@
#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
+#endif
/* Allow disabling of core subsystems */
#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@