Skip to content

Could NOT find CURL cmake error, when using a cmake package manager, and including curl already #790

@bsergean

Description

@bsergean

Description

Our C++ build system uses cpm (which is based on cmake FetchContent). We bring in curl that way (with cpm), and after that we include sentry with cpm (see in the repro steps). When doing so we get a could not find curl cmake error.

This is a chicken and eggs problem, but maybe it could be solved. For some reason I didn't get it on my mac version which uses a more recent cmake.

When does the problem happen

  • [x ] During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: linux
  • Compiler: gcc-11
  • CMake version and config: [, SENTRY_BACKEND=breakpad]

Steps To Reproduce

set(sentry_version 5.3.0)
cpmaddpackage(
  NAME
  sentry
  VERSION
  ${sentry_version}
  OPTIONS
  "BUILD_SHARED_LIBS OFF"
  "SENTRY_TRANSPORT curl"   # Should be the default
  "SENTRY_BACKEND breakpad" # we could try crashpad, but it might have more dependencies 
  GIT_REPOSITORY
  "https://github.com/getsentry/sentry-native"
  GIT_TAG
  ${sentry_version})

then somewhere in your project, do `target_link_libraries(myproject sentry::sentry)

Log output

-- SENTRY_SDK_NAME=
CMake Error at /usr/local/cmake-3.21.4-linux-x86_64/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/cmake-3.21.4-linux-x86_64/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/cmake-3.21.4-linux-x86_64/share/cmake-3.21/Modules/FindCURL.cmake:181 (find_package_handle_standard_args)
  build/_deps/sentry-src/CMakeLists.txt:277 (find_package)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions