If you can use pkg-config: pkg_search_module()
can find OpenSSL for you.
# Search OpenSSL
find_package(PkgConfig REQUIRED)
pkg_search_module(OPENSSL REQUIRED openssl)
if( OPENSSL_FOUND )
include_directories(${OPENSSL_INCLUDE_DIRS})
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
else()
# Error; with REQUIRED, pkg_search_module() will throw an error by it's own
endif()
target_link_libraries(${YOUR_TARGET_HERE} ${OPENSSL_LIBRARIES})