kylemanna
5/19/2017 - 7:13 PM

cmake magic

cmake magic

# Print size of the build to monitor
add_custom_command(TARGET ${TARGET_ELF} POST_BUILD
    COMMAND arm-none-eabi-size ${EXECUTABLE_OUTPUT_PATH}/${TARGET_ELF})

# Generate cscope target for `make cscope`
get_target_property(TARGET_SOURCES "${TARGET_ELF}" SOURCES)
add_custom_command(OUTPUT cscope.out
    DEPENDS ${TARGET_SOURCES}
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    COMMAND cscope -k -b -P ${PROJECT_SOURCE_DIR} ${TARGET_SOURCES}
)
add_custom_target(cscope DEPENDS cscope.out)

include(git_version)
git_version_generate("${TARGET_SOURCES}"
    "${CMAKE_CURRENT_SOURCE_DIR}/source/version.c.in"
    "${CMAKE_CURRENT_BINARY_DIR}/version.c")