Reputation: 121
I want to make a Conan package for a project I found on Github. This project is a CMake project and depends on openssl. The project finds openssl with a normal find_package.
My recipe declares the openssl dependency obviously, but where I struggle is how do I get the find_package(openssl) inside the project's CMake to find the openssl obtained by Conan?
Upvotes: 0
Views: 489
Reputation: 3887
You need cmake_find_package generator.
from conans import ConanFile
class Foo(ConanFile):
requires = "openssl/1.1.1l"
generators = "cmake", "cmake_find_package"
...
This will generate Findxxx.cmake
for all your dependencies.
If you are creating packages for your first time, I suggest you reading how to create a package from official docs, and the best practices from Conan Center Index.
UPDATE: Using CMakeDeps
Many improvements have been made for Conan 2.0, including a new approach for generators. The CMakeDeps is new way to go when needing xxx-config.cmake
. It's not documented on getting started yet, but its reference brings a very straightforward example.
Upvotes: 2