Commit f2363623e1

Alex Rønne Petersen <alex@alexrp.com>
2025-04-16 20:46:41
cmake: Map MinSizeRel to ReleaseSmall.
1 parent 19888f7
Changed files (1)
CMakeLists.txt
@@ -943,13 +943,18 @@ set(ZIG_RELEASE_SAFE OFF CACHE BOOL "Build Zig as ReleaseSafe (with debug assert
 if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
   list(APPEND ZIG_BUILD_ARGS -Doptimize=Debug)
 else()
-  if(ZIG_RELEASE_SAFE)
-    list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseSafe)
+  if("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
+    list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseSmall)
   else()
-    list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseFast)
-  endif()
-  if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
-    list(APPEND ZIG_BUILD_ARGS -Dstrip)
+    # Release and RelWithDebInfo
+    if(ZIG_RELEASE_SAFE)
+      list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseSafe)
+    else()
+      list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseFast)
+    endif()
+    if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
+      list(APPEND ZIG_BUILD_ARGS -Dstrip)
+    endif()
   endif()
 endif()