~aleteoryx/muditaos

ref: 35dc3262d9f3965c59e57d5da6572c672fb8a2a7 muditaos/cmake/modules/AddHexTarget.cmake -rw-r--r-- 462 bytes
35dc3262 — Paweł Joński [BH-1315] Move layouts to common, fix layouts ownership 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function(add_hex_target SOURCE_TARGET)
    set(HEX_FILE ${SOURCE_TARGET}.hex)
    add_custom_command(
        COMMENT "Generate ${HEX_FILE}"
        OUTPUT ${CMAKE_BINARY_DIR}/${HEX_FILE}
        DEPENDS ${SOURCE_TARGET}
        COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${SOURCE_TARGET}> ${CMAKE_BINARY_DIR}/${HEX_FILE}

        )
    add_custom_target(
        ${HEX_FILE}-target ALL
        DEPENDS ${CMAKE_BINARY_DIR}/${HEX_FILE}
        )
endfunction()