提交 2dc3b4d7 编写于 作者: Y Yuan Shuai 提交者: Xiaoyang LI

[CMAKE] Abandon strip when CMAKE_BUILD_TYPE=Debug (#2155)

* [CMAKE] Abandon strip when CMAKE_BUILD_TYPE=Debug

* Add CMAKE_BUILD_TYPE info in cmake. test=develop
上级 f4a42296
...@@ -95,6 +95,7 @@ if(NOT CMAKE_BUILD_TYPE) ...@@ -95,6 +95,7 @@ if(NOT CMAKE_BUILD_TYPE)
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
FORCE) FORCE)
endif() endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
# check options # check options
if (LITE_ON_TINY_PUBLISH) if (LITE_ON_TINY_PUBLISH)
......
...@@ -167,10 +167,12 @@ function(lite_cc_binary TARGET) ...@@ -167,10 +167,12 @@ function(lite_cc_binary TARGET)
target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers) target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers)
if (NOT APPLE) if (NOT APPLE)
# strip binary target to reduce size # strip binary target to reduce size
add_custom_command(TARGET ${TARGET} POST_BUILD if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
COMMAND "${CMAKE_STRIP}" -s add_custom_command(TARGET ${TARGET} POST_BUILD
"${TARGET}" COMMAND "${CMAKE_STRIP}" -s
COMMENT "Strip debug symbols done on final executable file.") "${TARGET}"
COMMENT "Strip debug symbols done on final executable file.")
endif()
endif() endif()
# collect targets need to compile for lite # collect targets need to compile for lite
if (NOT args_EXCLUDE_COMPILE_DEPS) if (NOT args_EXCLUDE_COMPILE_DEPS)
...@@ -215,10 +217,12 @@ function(lite_cc_test TARGET) ...@@ -215,10 +217,12 @@ function(lite_cc_test TARGET)
) )
_lite_cc_test(${TARGET} SRCS ${args_SRCS} DEPS ${deps} ARGS ${args_ARGS}) _lite_cc_test(${TARGET} SRCS ${args_SRCS} DEPS ${deps} ARGS ${args_ARGS})
# strip binary target to reduce size # strip binary target to reduce size
add_custom_command(TARGET ${TARGET} POST_BUILD if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
COMMAND "${CMAKE_STRIP}" -s add_custom_command(TARGET ${TARGET} POST_BUILD
"${TARGET}" COMMAND "${CMAKE_STRIP}" -s
COMMENT "Strip debug symbols done on final executable file.") "${TARGET}"
COMMENT "Strip debug symbols done on final executable file.")
endif()
target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers) target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers)
file(APPEND ${offline_test_registry_file} "${TARGET}\n") file(APPEND ${offline_test_registry_file} "${TARGET}\n")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册