Skip to content

find_package for CMake #792

@jmafc

Description

@jmafc

Is your feature request related to a problem? Please describe.
The suggested approach of using FetchContent to include cpr causes it (and everything else) to be checked and rebuilt (including all of curl and its tests) any time I tweak my CMakeLists.txt (which I've been doing rather frequently because I'm migrating other programs--and only two of which use cpr and those are essentially done).

Describe the solution you'd like
A find_package alternative to the FetchContent suggestion.

Describe alternatives you've considered
I built cpr locally and installed it to /usr/local/lib and added find_package to my CMakeLists.txt. However, cmake complained about not being able to find cprConfig.cmake or cpr-config.cmake. Since the latter file exists in your root directory, I copied it manually to /usr/local/lib/cmake/CPR. However, cmake now complains:

CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
  Could NOT find CPR (missing: CPR_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/lib/cmake/CPR/cpr-config.cmake:21 (find_package_handle_standard_args)

So what I'm really asking is that the work that was started when that cpr-config.cmake was created be completed so that find_package can be used.

Additional context
Using cpr 1.9.0 on Debian 11.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions