commit c3f637a54cbb36c5dd6ec9e772ddc0930316d790 (tree)
parent 96ebf9396f31c8645a2d0f064f211a25796f4c3e
Author: Andrew Kelley <andrew@ziglang.org>
Date: Tue, 22 Jun 2021 12:11:28 -0700
cmake: debug builds of zig enable logging by default
when logging is enabled, the --debug-log flag is available.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -91,7 +91,12 @@ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries
set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1")
-set(ZIG_ENABLE_LOGGING off CACHE BOOL "enable logging")
+
+if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+ set(ZIG_ENABLE_LOGGING ON CACHE BOOL "enable logging")
+else()
+ set(ZIG_ENABLE_LOGGING OFF CACHE BOOL "enable logging")
+endif()
if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
set(ZIG_USE_LLVM_CONFIG ON CACHE BOOL "use llvm-config to find LLVM libraries")