diff --git a/CMakeLists.txt b/CMakeLists.txt index 8190bd83..5f0ee36d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,8 @@ option(ENABLE_WEPOLL "Enable wepoll" ON) option(ENABLE_VIDEOSTACK "Enable video stack" OFF) option(DISABLE_REPORT "Disable report to report.zlmediakit.com" OFF) option(USE_SOLUTION_FOLDERS "Enable solution dir supported" ON) +option(ENABLE_OBJCOPY "Enable use objcopy to generate debug info file" ON) + ############################################################################## # 设置socket默认缓冲区大小为256k.如果设置为0则不设置socket的默认缓冲区大小,使用系统内核默认值(设置为0仅对linux有效) # Set the default buffer size of the socket to 256k. If set to 0, the default buffer size of the socket will not be set, @@ -199,10 +201,8 @@ if(UNIX) set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g3") else() find_program(OBJCOPY_FOUND objcopy) - if (OBJCOPY_FOUND) + if (OBJCOPY_FOUND AND ENABLE_OBJCOPY) set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g3") - else() - set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g0") endif() endif() elseif(WIN32) diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index f6541e21..ca622a6d 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -84,7 +84,8 @@ if(MSVC) endif() #relase 类型时额外输出debug调试信息 -if(UNIX) +string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) +if(UNIX AND ENABLE_OBJCOPY) if("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release") find_program(OBJCOPY_FOUND objcopy) if (OBJCOPY_FOUND) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 9c907475..e5d52abc 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -69,7 +69,7 @@ install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_RUNTIME}) #relase 类型时额外输出debug调试信息 string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) -if(UNIX) +if(UNIX AND ENABLE_OBJCOPY) if("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release") find_program(OBJCOPY_FOUND objcopy) if (OBJCOPY_FOUND)