'Cmake/gRPC - Unable to find OpenSSL on Mac

I want to use gRPC library for my project. Here is my CmakeLists.txt:

target_link_libraries(${LibName} PUBLIC
        ${CMAKE_THREAD_LIBS_INIT}
        asio
        threads
        fmt
        utf8cpp
        mysql
        zlib
        g3dlib
        curl
        rapidjson
        uuid
        gRPC::grpc++
)

If I remove the line gRPC::grpc++ all is fine. However I get the following error when I try to run cmake:

CMake Error at Source/Common/CMakeLists.txt:57 (add_library):
  Target "Common" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at Source/Common/CMakeLists.txt:57 (add_library):
  Target "Common" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

I have openssl installed on my Mac. Take a look:

☁  ~  openssl version
LibreSSL 2.8.3
☁  ~  which openssl
/usr/bin/openssl

If I add find_package(OpenSSL REQUIRED) in my CmakeLists I get this error:

CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL (missing: OPENSSL_INCLUDE_DIR)

How can I solve this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source