From 7bb2caed229ef96aa10dbd3be555c89c74e65b3d Mon Sep 17 00:00:00 2001 From: Mateusz Piesta Date: Mon, 20 Feb 2023 12:32:31 +0100 Subject: [PATCH] [MOS-297] Fixed release build for the simulator Fixed. --- cmake/modules/Utils.cmake | 10 ++++++++-- module-bluetooth/CMakeLists.txt | 1 + third-party/libical/CMakeLists.txt | 7 +++++++ third-party/lwext4/CMakeLists.txt | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cmake/modules/Utils.cmake b/cmake/modules/Utils.cmake index b75f28e1de748d8f84727852d1c91cd1b7d1d3f9..198d5abbb8f4550a3b75aa4dd9cb3028d845084d 100644 --- a/cmake/modules/Utils.cmake +++ b/cmake/modules/Utils.cmake @@ -21,9 +21,15 @@ macro(print_var VARIABLE) endmacro() function(strip_executable TARGET) + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(STRIP_PARAMS "-S") + else() + set(STRIP_PARAMS --strip-debug --strip-unneeded) + endif () + if (${CMAKE_BUILD_TYPE} STREQUAL "Release") add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $ + COMMAND ${CMAKE_STRIP} ${STRIP_PARAMS} $ COMMENT "Striping ${TARGET}" ) endif() @@ -33,7 +39,7 @@ function(strip_executable TARGET) COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $ $.debug - COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $ + COMMAND ${CMAKE_STRIP} ${STRIP_PARAMS} $ COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$.debug $ COMMENT "Striping ${TARGET}" diff --git a/module-bluetooth/CMakeLists.txt b/module-bluetooth/CMakeLists.txt index f6f1838dabb4e7ae3fcf6ef99ff9214d3444ea4c..9b6860efde76197517b1cf4292c53b210038017e 100644 --- a/module-bluetooth/CMakeLists.txt +++ b/module-bluetooth/CMakeLists.txt @@ -55,6 +55,7 @@ target_compile_options(${PROJECT_NAME} -Wno-missing-field-initializers -Wno-unused-function -Wno-implicit-fallthrough + -Wno-stringop-truncation # C only flags "$<$:-Wno-old-style-declaration>" ) diff --git a/third-party/libical/CMakeLists.txt b/third-party/libical/CMakeLists.txt index dc42852357cbd8538ed9e4bf61e32325ad5c6134..db91a25b14aa29acd969cb49ec39a324c626b1d8 100644 --- a/third-party/libical/CMakeLists.txt +++ b/third-party/libical/CMakeLists.txt @@ -3,4 +3,11 @@ SET(STATIC_ONLY TRUE) SET(ICAL_BUILD_DOCS FALSE) SET(ICAL_GLIB FALSE) SET(LIBICAL_BUILD_TESTING FALSE) + +include(libical/cmake/modules/LibIcalMacrosInternal.cmake) + +# Turn off false positive errors caused by calls to strncpy and snprintf. +libical_add_cflag(-Wno-format-truncation NO_FORMAT_TRUNCATION) +libical_add_cflag(-Wno-stringop-truncation NO_STRINGOP_TRUNCATION) + add_subdirectory(libical) diff --git a/third-party/lwext4/CMakeLists.txt b/third-party/lwext4/CMakeLists.txt index 982f15a4c28be26d1e73a7628a2920932eb6f7a2..cbf0054372c60aacce6c78f64f2a0387a43fefe7 100644 --- a/third-party/lwext4/CMakeLists.txt +++ b/third-party/lwext4/CMakeLists.txt @@ -16,6 +16,7 @@ target_include_directories(lwext4 target_compile_options(lwext4 PRIVATE -Wno-format + -Wno-stringop-truncation ) target_sources(lwext4