When using CMake and vcpkg, `cannot create ALIAS target "Backward::Backward"`
midrare opened this issue · 0 comments
midrare commented
Description
When using CMake with vcpkg, adding backwards causes an error due to duplicating target. Platform is Windows 11. vcpkg is 2023-03-29-664f8bb619b752430368d0f30a8289b761f5caba
. cmake is 3.26.3
. backwards-cpp is dc8b8c76822dcbc8918f032171050ad90e11eb7f
. Compiler is MSVC 2022.
Steps to reproduce
- In CMakeLists.txt,
CPMAddPackage("gh:bombela/backward-cpp#dc8b8c7")
oradd_subdirectory(backwards-cpp)
- In command line,
cmake .. -G "NMake Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=C:/opt/vcpkg/scripts/buildsystems/vcpkg.cmake
- Observe error
-- Running vcpkg install - done
-- CPM: adding package backward-cpp@ (dc8b8c7)
-- Could NOT find libdw (missing: LIBDW_LIBRARY LIBDW_INCLUDE_DIR)
-- Could NOT find libbfd (missing: LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
-- Could NOT find libdwarf (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR LIBELF_LIBRARY LIBELF_INCLUDE_DIR LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
-- Found Backward: C:/Users/shodan/Projects/instiller-cpp/cmake-build/_deps/backward-cpp-src
CMake Error at C:/opt/vcpkg/scripts/buildsystems/vcpkg.cmake:632 (_add_library):
_add_library cannot create ALIAS target "Backward::Backward" because
another target with the same name already exists.
Call Stack (most recent call first):
cmake-build/_deps/backward-cpp-src/CMakeLists.txt:93 (add_library)
-- Configuring incomplete, errors occurred!
From testing, this started with commit 490fd39
. The last working commit was 90398ee
.