From 81a807b6cf5704f39379fc7bcabd6a61a63c7eed Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Sun, 26 Jan 2025 13:04:23 +0000 Subject: [PATCH] Configuration - Single config lib direct linking #289 Enhance PROCESS_CSF_LIBRARIES function to track last detected library for improved directory handling --- adm/cmake/occt_macros.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake index efef453612..605c614930 100644 --- a/adm/cmake/occt_macros.cmake +++ b/adm/cmake/occt_macros.cmake @@ -768,6 +768,7 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME) string (REGEX MATCHALL "(^|;)3RDPARTY_[^;]+_LIBRARY[^;]*" ALL_CACHE_VARIABLES "${ALL_CACHE_VARIABLES}") set (DEBUG_DIR "") set (RELEASE_DIR "") + set (LAST_DETECTED_LIBRARY "") foreach (CACHE_VARIABLE ${ALL_CACHE_VARIABLES}) set (CURRENT_CACHE_LIBRARY ${${CACHE_VARIABLE}}) string (TOLOWER "${CACHE_VARIABLE}" CACHE_VARIABLE) @@ -782,6 +783,7 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME) "3rdparty_${CSF_WO_VERSION}_library" STREQUAL "${CACHE_VARIABLE}" OR NOT "x${IS_ENDING}" STREQUAL "x" OR NOT "x${IS_ENDING_WO_VERSION}" STREQUAL "x") + set (LAST_DETECTED_LIBRARY "${CURRENT_CACHE_LIBRARY}") get_filename_component(LIBRARY_NAME "${CURRENT_CACHE_LIBRARY}" NAME) list (APPEND FOUND_LIBS "${LIBRARY_NAME}") get_filename_component(LIBRARY_DIR "${CURRENT_CACHE_LIBRARY}" DIRECTORY) @@ -789,6 +791,7 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME) set (LIBRARY_FROM_CACHE 1) elseif ("3rdparty_${CSF_LIBRARY}_library_debug" STREQUAL "${CACHE_VARIABLE}" OR "3rdparty_${CSF_LIBRARY}_debug_library" STREQUAL "${CACHE_VARIABLE}") + set (LAST_DETECTED_LIBRARY "${CURRENT_CACHE_LIBRARY}") get_filename_component(LIBRARY_NAME "${CURRENT_CACHE_LIBRARY}" NAME) list (APPEND FOUND_LIBS "${LIBRARY_NAME}") get_filename_component(LIBRARY_DIR "${CURRENT_CACHE_LIBRARY}" DIRECTORY) @@ -807,6 +810,8 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME) if (DEBUG_DIR AND RELEASE_DIR) list (APPEND FOUND_DEBUG_DIRS "${DEBUG_DIR}") list (APPEND FOUND_RELEASE_DIRS "${RELEASE_DIR}") + elseif (EXISTS "${LAST_DETECTED_LIBRARY}") + list (APPEND FOUND_DEBUG_DIRS "${LAST_DETECTED_LIBRARY}") elseif (DEBUG_DIR) list (APPEND FOUND_DEBUG_DIRS "${DEBUG_DIR}") list (APPEND FOUND_RELEASE_DIRS "${DEBUG_DIR}")