Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to support BSD sed #170

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libpicotcp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ if(LibPicotcp)
" -I$<JOIN:$<TARGET_PROPERTY:muslc,INTERFACE_INCLUDE_DIRECTORIES>, -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
Expand All @@ -72,6 +72,13 @@ if(LibPicotcp)
add_custom_target(get_muslc)
add_dependencies(get_muslc muslc)

# GNU sed does not require an explicit suffix for the -i argument but BSD does.
# BSD also expects a space between the -i and the suffix while GNU expects nothing
set(sed_inplace_suffix "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a comment explaining why the behaviour is needed on macOS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a comment here would be nice

if(CMAKE_HOST_APPLE)
set(sed_inplace_suffix "''")
endif()
lsf37 marked this conversation as resolved.
Show resolved Hide resolved

# build picotcp using its very own build system
include(ExternalProject)
ExternalProject_Add(
Expand All @@ -89,6 +96,7 @@ if(LibPicotcp)
PATCH_COMMAND
sed
-i
${sed_inplace_suffix}
"s/(CROSS_COMPILE)gcc/(C_COMPILER)/g"
picotcp/Makefile
CONFIGURE_COMMAND
Expand Down