CMake target exports are not created if not using system curl
envgap__libcpr__cpr-1012
01 / FAILURE SIGNATURE
As reported upstream
```CMake Error: install(EXPORT "myProject_Targets" ...) includes target "myProject" which requires target "cpr" that is not in any export set.```
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
8efa3d345091bc3e3087a4bdd1e699f201e55a46- Manifest
cpr/CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
libcpr/cpr #1012 · read the original issue
### Description
When building and installing cpr using curl that is not installed in the system no CMake export sets are created, possibly leading to errors in projects dependent on cpr. When installing projects dependent on cpr the following CMake error might pop up:
```CMake Error: install(EXPORT "myProject_Targets" ...) includes target "myProject" which requires target "cpr" that is not in any export set.```
Is there a specific reason why the exports are omitted in this case?
For most builds this is not an issue, but it can become an issue if CMakes `FetchContent` together with find_package is used to build a dependency tree. (This is not a very good way to handle dependencies, but it beats checking in binaries to git)
### Example/How to Reproduce
See the CMakeLists.txt in the following example.
https://github.com/bernedom/CPR_Export_Failure_Example
To build it use
```
cmake -S . -B ./build
```
Configuration should fail with the following error:
`CMake Error: install(EXPORT "unleash_Targets" ...) includes target "unleash" which requires target "cpr" that is not in any export set.`
### Possible Fix
the fix would be changing ln 81ff in In the file https://github.com/libcpr/cpr/blob/master/cpr/CMakeLists.txt like this:
```
install(TARGETS cpr
EXPORT cprTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT cprTargets
FILE cprTargets.cmake
NAMESPACE cpr::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cpr)
```
### Where did you get it from?
GitHub (branch e.g. master)
### Additional Context/Your Environment
CMake version 3.25 or higher (possibly other versions are also affected)
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]