This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
fsfw_example_public/lwip/CMakeLists.txt
2021-04-27 17:22:34 +02:00

56 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.13)
option(LWIP_GENERATE_SECTIONS "Generate function and data sections" ON)
if(LWIP_GENERATE_SECTIONS)
option(LWIP_REMOVE_UNUSED_CODE "Remove unused sections" ON)
endif()
set(LWIP_LIB_NAME lwip)
add_library(${LWIP_LIB_NAME})
add_subdirectory(src)
add_subdirectory(system)
if(NOT LWIP_CONFIG_PATH)
message(WARNING "lwIP configuration include path LWIP_CONFIG_PATH not set!")
endif()
if(IS_ABSOLUTE ${LWIP_CONFIG_PATH})
set(LWIP_CONFIG_PATH_ABS "${LWIP_CONFIG_PATH}")
else()
get_filename_component(LWIP_CONFIG_PATH_ABS
${LWIP_CONFIG_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}
)
endif()
if(CMAKE_VERBOSE)
message(STATUS "lwIP configuration path: ${LWIP_CONFIG_PATH}")
endif()
target_include_directories(${LWIP_LIB_NAME} PRIVATE
${LWIP_CONFIG_PATH_ABS}
src/include
system
)
target_include_directories(${LWIP_LIB_NAME} INTERFACE
system
src/include
)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(LWIP_GENERATE_SECTIONS)
target_compile_options(${LWIP_LIB_NAME} PRIVATE
"-ffunction-sections"
"-fdata-sections"
)
endif()
if(LWIP_REMOVE_UNUSED_CODE)
target_link_options(${LWIP_LIB_NAME} PRIVATE
"Wl,--gc-sections"
)
endif()
endif()