url: cmake errors out
I’m building a project with Boost 1.79 via vcpkg. Since Boost.URL isn’t in vcpkg I’m using CPM.cmake (a wrapper over FetchContent) which is used successfully for various other things. There’s no version or tag so I’m using a hash directly like so:
CPMAddPackage("gh:CPPAlliance/url#aecf3a621805c764017dfb92a79008cb74f1229c")
Note I haven’t added anything else to cmake as yet. It downloads ok:
[CMake] -- CPM: adding package url@0 (aecf3a621805c764017dfb92a79008cb74f1229c to C:/Temp/cpm-source-cache/url/f99d17f730b235622d8217f31f9c10de78e58446)
However later it errors out:
1> [CMake] -- Found Boost: <...>/out/build/x64-debug-clang/vcpkg_installed/x64-windows-cpp20/include (found version "1.79.0") found components: coroutine iostreams thread context regex chrono atomic
1> [CMake] CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:573 (_add_executable):
1> [CMake] _add_executable cannot create target "tests" because another target with
1> [CMake] the same name already exists. The existing target is a custom target
1> [CMake] created in source directory
1> [CMake] "C:/Temp/cpm-source-cache/url/f99d17f730b235622d8217f31f9c10de78e58446/test".
I’m not sure why it’s trying to add a ‘test’ target in the first place. I saw another ticket saying detection of an existing Boost tree was heuristic, so maybe it’s that. Either way is there anything I can set in cmake to make this work? Is there another recommended way to add this repo (short of a copy-paste into our source tree)?
Thx.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- fix find_package fix #219, fix #225, fix #244, fix #188 — committed to alandefreitas/url by alandefreitas 2 years ago
- fix find_package fix #219, fix #225, fix #244, fix #188 — committed to alandefreitas/url by alandefreitas 2 years ago
- fix find_package fix #219, fix #225, fix #244, fix #188 — committed to alandefreitas/url by alandefreitas 2 years ago
- fix find_package fix #219, fix #225, fix #244, fix #188 — committed to alandefreitas/url by alandefreitas 2 years ago
It looks like you have to update boost.
Ah the clearing of the cache. And people say cmake is unintuitive, they must be crazy. Ok.
Yes getting it into vcpkg and Conan (either as an official part of Boost or before that) would probably help adoption.
Anyway it’s working now, I’ll get to the actual using the library part now and see how that goes.