From ed13149dc772c52f4b0f7e17dc8bd3659caa1196 Mon Sep 17 00:00:00 2001 From: Alwin Joshy Date: Mon, 11 Sep 2023 17:34:34 +1000 Subject: [PATCH] Change to support BSD sed Signed-off-by: Alwin Joshy --- libpicotcp/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libpicotcp/CMakeLists.txt b/libpicotcp/CMakeLists.txt index 1671b1acb..96d478abb 100644 --- a/libpicotcp/CMakeLists.txt +++ b/libpicotcp/CMakeLists.txt @@ -45,14 +45,14 @@ if(LibPicotcp) " -I$, -I>" ) - if (CMAKE_C_COMPILER_ID STREQUAL "Clang") + if(CMAKE_C_COMPILER_ID STREQUAL "Clang") list(APPEND compile_options "${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}") set(C_COMPILER clang) else() set(C_COMPILER ${CROSS_COMPILER_PREFIX}gcc) endif() - if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(perf_flags "\"PERF=1\" \"DEBUG=0\"") endif() # generate a build.sh script to avoid nasty escape issues, we then invoke this in ExternalProject_Add @@ -72,6 +72,12 @@ if(LibPicotcp) add_custom_target(get_muslc) add_dependencies(get_muslc muslc) + set(sed_inplace_suffix "") + # GNU sed does not require an explicit suffix but BSD does + if(CMAKE_HOST_APPLE) + set(sed_inplace_suffix "''") + endif() + # build picotcp using its very own build system include(ExternalProject) ExternalProject_Add( @@ -89,6 +95,7 @@ if(LibPicotcp) PATCH_COMMAND sed -i + ${sed_inplace_suffix} "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" picotcp/Makefile CONFIGURE_COMMAND