diff --git a/CMakeLists.txt b/CMakeLists.txt index 9834de8f962b1888b25349791466cfa0902b2a78..fd846b19b73c330eeeeb0afe68bf13f29a5fc248 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ if(NOT CMAKE_BUILD_TYPE) "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE) endif() +message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") # check options if (LITE_ON_TINY_PUBLISH) diff --git a/cmake/lite.cmake b/cmake/lite.cmake index e5253072f8b28129d066926be3ac85616c73677d..37fca1bfa18a29a6e40589443771d97e7449dc1e 100644 --- a/cmake/lite.cmake +++ b/cmake/lite.cmake @@ -167,10 +167,12 @@ function(lite_cc_binary TARGET) target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers) if (NOT APPLE) # strip binary target to reduce size - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND "${CMAKE_STRIP}" -s - "${TARGET}" - COMMENT "Strip debug symbols done on final executable file.") + if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND "${CMAKE_STRIP}" -s + "${TARGET}" + COMMENT "Strip debug symbols done on final executable file.") + endif() endif() # collect targets need to compile for lite if (NOT args_EXCLUDE_COMPILE_DEPS) @@ -215,10 +217,12 @@ function(lite_cc_test TARGET) ) _lite_cc_test(${TARGET} SRCS ${args_SRCS} DEPS ${deps} ARGS ${args_ARGS}) # strip binary target to reduce size - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND "${CMAKE_STRIP}" -s - "${TARGET}" - COMMENT "Strip debug symbols done on final executable file.") + if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND "${CMAKE_STRIP}" -s + "${TARGET}" + COMMENT "Strip debug symbols done on final executable file.") + endif() target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers) file(APPEND ${offline_test_registry_file} "${TARGET}\n")