From b6da3fc47e9e48cc6cfad42f4afa7239a1f46cfa Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 8 Jan 2024 16:32:47 +0000 Subject: [PATCH] Fix #2493, Relative prefix exclusion for cfe implementation file search --- cmake/global_functions.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/global_functions.cmake b/cmake/global_functions.cmake index 7a363f0ea..494b6c62c 100644 --- a/cmake/global_functions.cmake +++ b/cmake/global_functions.cmake @@ -54,10 +54,13 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) foreach(BASEDIR ${IMPL_SEARCH_BASEDIRS}) list(APPEND IMPL_SEARCH_PATH "${BASEDIR}${FILE_NAME}") + # Get relative directory + string(REPLACE ${MISSION_SOURCE_DIR} "" RELATIVEDIR ${BASEDIR}) + # A target-specific prefixed filename gets priority over a direct filename match - # But do not include this variant if the prefix is already part of the basedir + # But do not include this variant if the prefix is already part of the relative search path foreach (PREFIX ${LOCATEIMPL_ARG_PREFIX}) - if (NOT "${BASEDIR}" MATCHES "/${PREFIX}/") + if (NOT "${RELATIVEDIR}" MATCHES "/${PREFIX}/") list(APPEND IMPL_SEARCH_PATH "${BASEDIR}${PREFIX}_${FILE_NAME}") endif() endforeach()