@@ -189,10 +189,17 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
189
189
else ()
190
190
message ("NOTE: Selected ${TBL_SRC} as source for ${TBLWE} " )
191
191
endif ()
192
-
193
- add_library (${TGT} _${TBLWE} -obj OBJECT ${TBL_SRC} )
192
+
193
+ # NOTE: On newer CMake versions this should become an OBJECT library which makes this simpler.
194
+ # On older versions one may not referece the TARGET_OBJECTS property from the custom command.
195
+ # As a workaround this is built into a static library, and then the desired object is extracted
196
+ # before passing to elf2cfetbl. It is roundabout but it works.
197
+ add_library (${TGT} _${TBLWE} -obj STATIC ${TBL_SRC} )
194
198
target_link_libraries (${TGT} _${TBLWE} -obj PRIVATE core_api)
195
199
200
+ get_filename_component (TBLOBJ ${TBL} NAME )
201
+ string (APPEND TBLOBJ ${CMAKE_C_OUTPUT_EXTENSION} )
202
+
196
203
# IMPORTANT: This rule assumes that the output filename of elf2cfetbl matches
197
204
# the input file name but with a different extension (.o -> .tbl)
198
205
# The actual output filename is embedded in the source file (.c), however
@@ -201,7 +208,8 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
201
208
# current content of a dependency (rightfully so).
202
209
add_custom_command (
203
210
OUTPUT "${TABLE_DESTDIR} /${TBLWE} .tbl"
204
- COMMAND ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl $<TARGET_OBJECTS:${TGT} _${TBLWE} -obj>
211
+ COMMAND ${CMAKE_AR} x $<TARGET_FILE:${TGT} _${TBLWE} -obj>
212
+ COMMAND ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl "${TBLOBJ} "
205
213
DEPENDS ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl ${TGT} _${TBLWE} -obj
206
214
WORKING_DIRECTORY ${TABLE_DESTDIR}
207
215
)
@@ -462,7 +470,7 @@ function(cfs_app_check_intf MODULE_NAME)
462
470
configure_file (${CFE_SOURCE_DIR} /cmake/check_header.c.in ${CMAKE_CURRENT_BINARY_DIR} /src/check_${HDR} .c)
463
471
list (APPEND ${MODULE_NAME} _hdrcheck_SOURCES ${CMAKE_CURRENT_BINARY_DIR} /src/check_${HDR} .c)
464
472
endforeach (HDR ${ARGN} )
465
- add_library (${MODULE_NAME} _headercheck OBJECT ${${MODULE_NAME} _hdrcheck_SOURCES})
473
+ add_library (${MODULE_NAME} _headercheck STATIC EXCLUDE_FROM_ALL ${${MODULE_NAME} _hdrcheck_SOURCES})
466
474
467
475
# This causes the check to compile with the same set of defines and include dirs as specified
468
476
# in the "INTERFACE" properties of the actual module
0 commit comments