eive-obsw/cmake/HardwareOsPostConfig.cmake
Robin Mueller fe4315666b
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
added helper script for yocto installation
- Installs compiled binaries into yocto repo for rootfs rebuild
2022-05-06 15:27:56 +02:00

52 lines
1.3 KiB
CMake

function(post_source_hw_os_config)
if(LINKER_SCRIPT)
add_link_options(
-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(
$<$<COMPILE_LANGUAGE:C>:${C_DEFS} ${C_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>:${CXX_DEFS} ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>:${ASM_FLAGS}>
)
set(STRIPPED_OBSW_NAME ${CMAKE_PROJECT_NAME}-stripped)
set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped)
add_custom_command(
TARGET ${OBSW_NAME}
POST_BUILD
COMMAND ${CMAKE_STRIP} --strip-all ${OBSW_BIN_NAME} -o ${STRIPPED_OBSW_NAME}
BYPRODUCTS ${STRIPPED_OBSW_NAME}
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.."
)
add_custom_command(
TARGET ${WATCHDOG_NAME}
POST_BUILD
COMMAND ${CMAKE_STRIP} --strip-all eive-watchdog -o ${STRIPPED_WATCHDOG_NAME}
BYPRODUCTS ${STRIPPED_WATCHDOG_NAME}
COMMENT "Generating stripped executable ${STRIPPED_WATCHDOG_NAME}.."
)
endfunction()