eive-obsw/cmake/HardwareOsPostConfig.cmake

54 lines
1.2 KiB
CMake
Raw Normal View History

2020-12-29 01:09:59 +01:00
function(post_source_hw_os_config)
if(LINK_LWIP)
message(STATUS "Linking against ${LIB_LWIP_NAME} lwIP library")
if(LIB_LWIP_NAME)
target_link_libraries(${OBSW_NAME} PUBLIC
2020-12-29 01:09:59 +01:00
${LIB_LWIP_NAME}
)
else()
message(WARNING "lwIP library name not set!")
endif()
endif()
if(LINKER_SCRIPT)
add_link_options(
2020-12-29 01:09:59 +01:00
-T${LINKER_SCRIPT}
)
endif()
set(C_FLAGS "" CACHE INTERNAL "C flags")
set(C_DEFS ""
CACHE INTERNAL
"C Defines"
)
set(CXX_FLAGS ${C_FLAGS})
set(CXX_DEFS ${C_DEFS})
if(CMAKE_VERBOSE)
message(STATUS "C Flags: ${C_FLAGS}")
message(STATUS "CXX Flags: ${CXX_FLAGS}")
message(STATUS "C Defs: ${C_DEFS}")
message(STATUS "CXX Defs: ${CXX_DEFS}")
endif()
# Generator expression. Can be used to set different C, CXX and ASM flags.
add_compile_options(
2020-12-29 01:09:59 +01:00
$<$<COMPILE_LANGUAGE:C>:${C_DEFS} ${C_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>:${CXX_DEFS} ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>:${ASM_FLAGS}>
)
set(STRIPPED_OBSW_NAME ${OBSW_NAME}-stripped)
2021-08-14 15:25:30 +02:00
2020-12-29 01:09:59 +01:00
add_custom_command(
TARGET ${OBSW_NAME}
2020-12-29 01:09:59 +01:00
POST_BUILD
COMMAND ${CMAKE_STRIP} --strip-all ${OBSW_NAME} -o ${STRIPPED_OBSW_NAME}
BYPRODUCTS ${STRIPPED_OBSW_NAME}
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.."
2020-12-29 01:09:59 +01:00
)
endfunction()