From 66be46135d6a7cd68b1ff4a2bf76f6099a2d4810 Mon Sep 17 00:00:00 2001 From: Alwin Joshy Date: Mon, 11 Sep 2023 14:14:19 +1000 Subject: [PATCH] Change to support BSD sed Signed-off-by: Alwin Joshy --- libpicotcp/CMakeLists.txt | 108 ++++++++++++++++++++++++++------------ 1 file changed, 73 insertions(+), 35 deletions(-) diff --git a/libpicotcp/CMakeLists.txt b/libpicotcp/CMakeLists.txt index 1671b1acb..5767e2c70 100644 --- a/libpicotcp/CMakeLists.txt +++ b/libpicotcp/CMakeLists.txt @@ -74,41 +74,79 @@ if(LibPicotcp) # build picotcp using its very own build system include(ExternalProject) - ExternalProject_Add( - picotcp_external - SOURCE_DIR - "picotcp_external" - DOWNLOAD_COMMAND - rsync - -qur - --exclude='.git' - ${PICOTCP_PATH} - - UPDATE_COMMAND - "" - PATCH_COMMAND - sed - -i - "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" - picotcp/Makefile - CONFIGURE_COMMAND - "" - BUILD_COMMAND - cd - /picotcp/ - && - sh - build.sh - BUILD_IN_SOURCE - 1 - INSTALL_COMMAND - "" - EXCLUDE_FROM_ALL - BUILD_BYPRODUCTS - "/picotcp/build/lib/libpicotcp.a" - DEPENDS - get_muslc - ) + if(CMAKE_HOST_APPLE) + ExternalProject_Add( + picotcp_external + SOURCE_DIR + "picotcp_external" + DOWNLOAD_COMMAND + rsync + -qur + --exclude='.git' + ${PICOTCP_PATH} + + UPDATE_COMMAND + "" + PATCH_COMMAND + sed + -i '' + "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" + picotcp/Makefile + CONFIGURE_COMMAND + "" + BUILD_COMMAND + cd + /picotcp/ + && + sh + build.sh + BUILD_IN_SOURCE + 1 + INSTALL_COMMAND + "" + EXCLUDE_FROM_ALL + BUILD_BYPRODUCTS + "/picotcp/build/lib/libpicotcp.a" + DEPENDS + get_muslc + ) + else() + ExternalProject_Add( + picotcp_external + SOURCE_DIR + "picotcp_external" + DOWNLOAD_COMMAND + rsync + -qur + --exclude='.git' + ${PICOTCP_PATH} + + UPDATE_COMMAND + "" + PATCH_COMMAND + sed + -i + "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" + picotcp/Makefile + CONFIGURE_COMMAND + "" + BUILD_COMMAND + cd + /picotcp/ + && + sh + build.sh + BUILD_IN_SOURCE + 1 + INSTALL_COMMAND + "" + EXCLUDE_FROM_ALL + BUILD_BYPRODUCTS + "/picotcp/build/lib/libpicotcp.a" + DEPENDS + get_muslc + ) + endif() file( GLOB