From a5905da7ea48bd725b8479d1af64aaefd6a58e29 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert Date: Mon, 15 Jun 2026 17:16:15 +0200 Subject: [PATCH] Fix CMake finder --- config/modules/crest-utils.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/config/modules/crest-utils.cmake b/config/modules/crest-utils.cmake index 340d26e4..c8475a0c 100644 --- a/config/modules/crest-utils.cmake +++ b/config/modules/crest-utils.cmake @@ -97,8 +97,10 @@ macro( "${${_pkg_uc}_BINARY_DIR}" ) - add_library("${package}::${package}" INTERFACE IMPORTED) - target_link_libraries("${package}::${package}" INTERFACE "${package}") + if(NOT TARGET "${package}::${package}") + add_library("${package}::${package}" INTERFACE IMPORTED) + target_link_libraries("${package}::${package}" INTERFACE "${package}") + endif() # We need the module directory in the subproject before we finish the configure stage if(NOT EXISTS "${${_pkg_uc}_BINARY_DIR}/include") @@ -122,8 +124,10 @@ macro( ) FetchContent_MakeAvailable("${_pkg_lc}") - add_library("${package}::${package}" INTERFACE IMPORTED) - target_link_libraries("${package}::${package}" INTERFACE "${package}") + if(NOT TARGET "${package}::${package}") + add_library("${package}::${package}" INTERFACE IMPORTED) + target_link_libraries("${package}::${package}" INTERFACE "${package}") + endif() # We need the module directory in the subproject before we finish the configure stage FetchContent_GetProperties("${_pkg_lc}" SOURCE_DIR "${_pkg_uc}_SOURCE_DIR")