Skip to content

Commit

Permalink
Fix nasa#1436, table object file name
Browse files Browse the repository at this point in the history
Use a shell glob instead of assuming a specific file name, this
should pick up the object file no matter how it was named, as
long as it ends in ${CMAKE_C_OUTPUT_EXTENSION}.

It does rely on/assume there is only one such file, so this might
break if one changes the name of a table without a clean rebuild.

A proper fix would still be to use TARGET_OBJECTS generator expression,
but that can't happen until Ubuntu 18.04 (w/ ver 3.10) is EOL.
  • Loading branch information
jphickey committed Apr 28, 2021
1 parent 73c338d commit 88b7e21
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
add_library(${TGT}_${TBLWE}-obj STATIC ${TBL_SRC})
target_link_libraries(${TGT}_${TBLWE}-obj PRIVATE core_api)

get_filename_component(TBLOBJ ${TBL} NAME)
string(APPEND TBLOBJ ${CMAKE_C_OUTPUT_EXTENSION})

# IMPORTANT: This rule assumes that the output filename of elf2cfetbl matches
# the input file name but with a different extension (.o -> .tbl)
# The actual output filename is embedded in the source file (.c), however
Expand All @@ -209,7 +206,7 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
add_custom_command(
OUTPUT "${TABLE_DESTDIR}/${TBLWE}.tbl"
COMMAND ${CMAKE_AR} x $<TARGET_FILE:${TGT}_${TBLWE}-obj>
COMMAND ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl "${TBLOBJ}"
COMMAND ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl "*${CMAKE_C_OUTPUT_EXTENSION}"
DEPENDS ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl ${TGT}_${TBLWE}-obj
WORKING_DIRECTORY ${TABLE_DESTDIR}
)
Expand Down

0 comments on commit 88b7e21

Please sign in to comment.