From 87f5eaa694c5c39624dbfdb6027c9491085d0450 Mon Sep 17 00:00:00 2001 From: CPunch Date: Sun, 5 Jun 2022 15:51:18 -0500 Subject: [PATCH] CMake: Minor debug refactoring - LAIKA_DEBUG_BUILD is set to true if lower(CMAKE_BUILD_TYPE) matches 'debug' --- CMakeLists.txt | 2 ++ bot/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58663c6..314a98e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ endif () string(TOLOWER ${CMAKE_BUILD_TYPE} RAWCMAKEBUILDTYPE) message(STATUS "CMAKE_BUILD_TYPE: " ${RAWCMAKEBUILDTYPE}) if(RAWCMAKEBUILDTYPE STREQUAL "debug") + set(LAIKA_DEBUG_BUILD on) if(WIN32) # statically link debug libs for windows message(STATUS "Adding MSVC Debug libs...") @@ -44,6 +45,7 @@ if(RAWCMAKEBUILDTYPE STREQUAL "debug") add_link_options(-fsanitize=address) endif () else() + set(LAIKA_DEBUG_BUILD off) # statically link non-debug libs if(WIN32) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") diff --git a/bot/CMakeLists.txt b/bot/CMakeLists.txt index aefb277..e41f244 100644 --- a/bot/CMakeLists.txt +++ b/bot/CMakeLists.txt @@ -14,7 +14,7 @@ file(GLOB_RECURSE BOTHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h) # include platform specific backends if(WIN32) file(GLOB_RECURSE BOTPLATFORMSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/win/**.c) - if (NOT RAWCMAKEBUILDTYPE STREQUAL "debug") + if (NOT LAIKA_DEBUG_BUILD) set(BOTFLAGS WIN32) endif () elseif(UNIX AND NOT APPLE) @@ -37,7 +37,7 @@ target_compile_definitions(LaikaBot PUBLIC "$<$:DEBUG>") target_include_directories(LaikaBot PUBLIC ${BOT_INCLUDEDIR}) # strip symbols for UNIX binaries -if((UNIX AND NOT APPLE) AND NOT RAWCMAKEBUILDTYPE STREQUAL "debug") +if((UNIX AND NOT APPLE) AND NOT LAIKA_DEBUG_BUILD) message(STATUS "Stripping LaikaBot symbols...") target_link_options(LaikaBot PRIVATE -s) endif () \ No newline at end of file