Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2296, add option to link to generated files #2300

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions cmake/global_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ endfunction(generate_c_headerfile)
#
function(generate_config_includefile)

cmake_parse_arguments(GENCONFIG_ARG "" "OUTPUT_DIRECTORY;FILE_NAME;FALLBACK_FILE;MATCH_SUFFIX" "PREFIXES" ${ARGN} )
cmake_parse_arguments(GENCONFIG_ARG "" "OUTPUT_DIRECTORY;FILE_NAME;FALLBACK_FILE;MATCH_SUFFIX" "PREFIXES;GENERATED_FILE" ${ARGN} )
if (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY)
set(GENCONFIG_ARG_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/inc")
endif (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY)
Expand All @@ -168,13 +168,20 @@ function(generate_config_includefile)
set(TGTFILE ${GENCONFIG_ARG_FILE_NAME})
endif()

# Use the common search function to find the candidate(s)
cfe_locate_implementation_file(SRC_LOCAL_PATH_LIST "${TGTFILE}"
ALLOW_LIST
FALLBACK_FILE "${GENCONFIG_ARG_FALLBACK_FILE}"
PREFIX ${GENCONFIG_ARG_PREFIXES} ${ARCH_PREFIXES}
SUBDIR config
)
if (GENCONFIG_ARG_GENERATED_FILE)
# A generated file may not yet exist at the time this runs, so just use
# what the caller said, no searching.
set(SRC_LOCAL_PATH_LIST ${GENCONFIG_ARG_GENERATED_FILE})
message(STATUS "Using file: [generated] ${SRC_LOCAL_PATH_LIST} for ${TGTFILE}")
else()
# Use the common search function to find the candidate(s)
cfe_locate_implementation_file(SRC_LOCAL_PATH_LIST "${TGTFILE}"
ALLOW_LIST
FALLBACK_FILE "${GENCONFIG_ARG_FALLBACK_FILE}"
PREFIX ${GENCONFIG_ARG_PREFIXES} ${ARCH_PREFIXES}
SUBDIR config
)
endif()

set(WRAPPER_FILE_CONTENT)
foreach(SELECTED_FILE ${SRC_LOCAL_PATH_LIST})
Expand Down