Skip to content

cmake: find_package(CURL CONFIG REQUIRED) can't find curl on Ubuntu #43

Open
@khei4

Description

@khei4

Describe the bug

$ dpkg -L libcurl4-openssl-dev
/.
/usr
/usr/bin
/usr/bin/curl-config
/usr/include
/usr/include/x86_64-linux-gnu
/usr/include/x86_64-linux-gnu/curl
/usr/include/x86_64-linux-gnu/curl/curl.h
...(omitted)
/usr/share/doc/libcurl4-openssl-dev/changelog.Debian.gz

$ cd liboai && cmake -Bbuild .
CMake Error at CMakeLists.txt:6 (find_package):
  Could not find a package configuration file provided by "CURL" with any of
  the following names:

    CURLConfig.cmake
    curl-config.cmake

  Add the installation prefix of "CURL" to CMAKE_PREFIX_PATH or set
  "CURL_DIR" to a directory containing one of the above files.  If "CURL"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

Just installing by apt like this doesn't work.
I think this is because find_package(CURL CONFIG REQUIRED) on CMakeLists.txt expect vcpkg use.

Replacing find_package(CURL CONFIG REQUIRED) and target_link_libraries(oai PRIVATE CURL::libcurl)
with target_link_libraries(oai PRIVATE curl) works well.

I'd be very happy if this works on Ubuntu 22.04. :)

To Reproduce

$ sudo apt update && sudo apt upgrade && sudo apt install curl && sudo apt-get install curl libcurl4-openssl-dev
$ cd liboai && cmake -Bbuild .

Code snippets

No response

OS

ubuntu 22.04

Library version

f0f2b45

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions