mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge pull request #23217 from selfisekai/cmake-release-safe
* cmake: Add ZIG_RELEASE_SAFE option to build as ReleaseSafe * cmake: Map MinSizeRel to ReleaseSmall.
This commit is contained in:
commit
3be6809e27
1 changed files with 15 additions and 3 deletions
|
|
@ -951,12 +951,24 @@ if(ZIG_EXTRA_BUILD_ARGS)
|
|||
list(APPEND ZIG_BUILD_ARGS ${ZIG_EXTRA_BUILD_ARGS})
|
||||
endif()
|
||||
|
||||
set(ZIG_RELEASE_SAFE OFF CACHE BOOL "Build Zig as ReleaseSafe (with debug assertions on)")
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
list(APPEND ZIG_BUILD_ARGS -Doptimize=Debug)
|
||||
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseFast)
|
||||
else()
|
||||
list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseFast -Dstrip)
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
|
||||
list(APPEND ZIG_BUILD_ARGS -Doptimize=ReleaseSmall)
|
||||
else()
|
||||
# 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()
|
||||
|
||||
if(ZIG_STATIC AND NOT MSVC)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue