-
Notifications
You must be signed in to change notification settings - Fork 356
Open
Description
Describe the bug
CMake errors are popping up when calling find_package multiple times.
CMake Error at C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/cmake/FindCMSIS.cmake:107 (add_custom_target):
add_custom_target cannot create target "CMSIS_LD_F401CB" because another
target with the same name already exists. The existing target is a custom
target created in source directory
"C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/examples/blinky".
See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/cmake/FindCMSIS.cmake:268 (cmsis_generate_default_linker_script)
CMakeLists.txt:41 (find_package)
CMake Error at C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/cmake/FindCMSIS.cmake:266 (add_library):
add_library cannot create imported target "CMSIS::STM32::F401CC" because
another target with the same name already exists.
Call Stack (most recent call first):
CMakeLists.txt:41 (find_package)
CMake Error at C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/cmake/FindCMSIS.cmake:107 (add_custom_target):
add_custom_target cannot create target "CMSIS_LD_F401CC" because another
target with the same name already exists. The existing target is a custom
target created in source directory
"C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/examples/blinky".
See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/heig-vd/projects/stm32-cmake/stm32-cmake-multiple-find-package-calls/cmake/FindCMSIS.cmake:268 (cmsis_generate_default_linker_script)
CMakeLists.txt:41 (find_package)
Sources to reproduce
Please provide link to repository showing the problem.
link to the commit causing an issue
Steps to reproduce
- Add multiple calls to the find_package function for CMSIS.
Expected behavior
On the first find_package call, the behavior shall not change. On subsequent calls, already existing custom targets shall not be created again.
Environment :
- OS: Windows
- Compiler: arm-none-eabi-gcc (Arm GNU Toolchain 12.2.MPACBTI-Rel1 (Build arm-12-mpacbti.34)) 12.2.1 20230214
- stm32-cmake: v2.1.0
- cmake: 3.25.0
- HAL/cube/CMSIS: stm32cubeF4 v1.27.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels