I had the same problem (openssl) and this worked for me on Ubuntu 14.04.1 LTS. The solution is the same up to Ubuntu 18.04 (tested).
sudo apt-get install libssl-dev
Answer from Arwen on Stack OverflowI had the same problem (openssl) and this worked for me on Ubuntu 14.04.1 LTS. The solution is the same up to Ubuntu 18.04 (tested).
sudo apt-get install libssl-dev
fixed it on macOS using
brew install openssl
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib
CMake cant find OpenSSL
c++ - CMake cannot find OpenSSL libraries in windows - Stack Overflow
CMake: Could NOT find OpenSSL
Windows build can't find OpenSSL
More recent OpenSSL versions (the 1.1.x series I think) slightly changed the formatting of how the version number was specified in the opensslv.h header. This caused CMake's version parsing code in its FindOpenSSL.cmake module to fail, which was then fixed around CMake 3.5.0. Furthermore, from OpenSSL 1.1.0, the library names on Windows are closer to their Unix counterparts and are named libcrypto and libssl (possibly with further suffixes) instead of the old names libeay32 and ssleay32. CMake 3.7.0 contained the update to account for this library name change. As a result of these two changes and fixes, if you want to use OpenSSL 1.1.0 or later with a CMake project, you should probably be using CMake 3.7.0 or later.
We had a similar problem with cmake 2.8.12.2 and OpenSSL 1.0.2u
CMake Error at /usr/share/cmake/Modules/FindOpenSSL.cmake:278 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:169 (FIND_PACKAGE)
To find out more details, you can add "--debug-output" option to cmake command.
In our case, it helped to specify the -D_OPENSSL_VERSION on cmake command line:
OPENSSL_VER=1.0.2u
cmake ...
-DOPENSSL_ROOT_DIR=$IDIR_BASE \
-DOPENSSL_INCLUDE_DIR=$IDIR_BASE/include \
-D_OPENSSL_VERSION="$OPENSSL_VER" \
cmake_minimum_required(VERSION 3.28) project(FindOpenSSL) set(CMAKE_CXX_STANDARD 23) add_executable(FindOpenSSL main.cpp) set(OPENSSL_ROOT_DIR "C:/Program Files/OpenSSL-Win64") find_package(OpenSSL REQUIRED)cmake_minimum_required(VERSION 3.28) project(FindOpenSSL) set(CMAKE_CXX_STANDARD 23) add_executable(FindOpenSSL main.cpp) set(OPENSSL_ROOT_DIR "C:/Program Files/OpenSSL-Win64") find_package(OpenSSL REQUIRED)
I have it as can bee seen here
And it works
I'm not feeling well, I feel extremely tired, please help. I'm using Clion
(I'm new to build systems and adding libraries, if I have provided insufficient information let me know in the comments.)
I've installed openssl lib using brew to /usr/local/Cellar/openssl (macOS) and when I compile my project I get an error:
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR)
CMakeLists.txt:
cmake_minimum_required(VERSION 3.15) project(recost)
set(CMAKE_CXX_STANDARD 20)
add tgbot-cpp
add_subdirectory(lib/tgbot-cpp)
add boost
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/local/Cellar/boost/1.70.0/include") set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr/local/Cellar/boost/1.70.0/lib")
add openssl
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/local/Cellar/openssl/1.0.2s/include") set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr/local/Cellar/openssl/1.0.2s/lib")
set(OPENSSL_ROOT_DIR "/usr/local/Cellar/openssl/1.0.2s/") set(OPENSSL_INCLUDE_DIR "/usr/local/Cellar/openssl/1.0.2s/include")
set(Boost_USE_MULTITHREADED ON)
find_package(Threads REQUIRED) find_package(OpenSSL REQUIRED) find_package(Boost COMPONENTS system REQUIRED) find_package(CURL) include_directories(/usr/local/include ${OPENSSL_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
set(BOOST_ROOT /usr/local/Cellar/boost/) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME ON) find_package(Boost REQUIRED COMPONENTS system)
target_include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(recost TgBot ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${CURL_LIBRARIES})
add_executable(recost main.cpp)