mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
cmake: Add ZIG_RELEASE_SAFE option to build as ReleaseSafe
This commit is contained in:
parent
d0911786c9
commit
19888f759f
@ -938,12 +938,19 @@ 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(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()
|
||||
|
||||
if(ZIG_STATIC AND NOT MSVC)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user