From 3c8b57afd2f5a48d426384f0fa581af6aac47019 Mon Sep 17 00:00:00 2001 From: NiSche <42242845+nische@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:43:51 +0200 Subject: [PATCH] Update FindCMSIS.cmake Wrap CMSIS_LD_.... with if to check if allready exsists --- cmake/FindCMSIS.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index d6a1a7c2..8b9db26d 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -104,9 +104,11 @@ function(cmsis_generate_default_linker_script FAMILY DEVICE CORE) -P "${STM32_CMAKE_DIR}/stm32/linker_ld.cmake" ) endif() - add_custom_target(CMSIS_LD_${DEVICE}${CORE_U} DEPENDS "${OUTPUT_LD_FILE}") - add_dependencies(CMSIS::STM32::${DEVICE}${CORE_C} CMSIS_LD_${DEVICE}${CORE_U}) - stm32_add_linker_script(CMSIS::STM32::${DEVICE}${CORE_C} INTERFACE "${OUTPUT_LD_FILE}") + if (NOT TARGET CMSIS_LD_${DEVICE}${CORE_U}) + add_custom_target(CMSIS_LD_${DEVICE}${CORE_U} DEPENDS "${OUTPUT_LD_FILE}") + add_dependencies(CMSIS::STM32::${DEVICE}${CORE_C} CMSIS_LD_${DEVICE}${CORE_U}) + stm32_add_linker_script(CMSIS::STM32::${DEVICE}${CORE_C} INTERFACE "${OUTPUT_LD_FILE}") + endif() endfunction() foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES})