How to link OpenSSL in CMake propely

Viewed 24

I'm trying to link OpenSSL library to my project using CMake. I'm using Ubuntu 22.04. All I do is

cmake_minimum_required(VERSION 3.4.1)

project (test)

add_executable(test test.cpp)

find_package(OpenSSL REQUIRED)


target_link_libraries(
    test PRIVATE OPENSSL::SSL
)

And I get an error Target "test" links to target "OPENSSL::SSL" but the target was not found.
I had installed OpenSSL with "sudo apt install libssl-dev" so it must be installed. What can I do here?

0 Answers
Related