I am attempting to use the CPPREST SDK in CLion on a Mac using CMake. I'm almost there, but I cannot seem to resolve the following linker error:
Undefined symbols for architecture x86_64:
  "_ERR_remove_thread_state", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in PongRemote.cpp.o
I have specified -lssl and -lcrypto, but still get this "thread state" error. Based on some research, it looks like it is coming from OpenSSL. I used Homebrew to install CPPREST.
I have tested this with literally just a main and the basic includes:
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
with a CMake of:
project(cpprest)
cmake_minimum_required(VERSION 3.8)
set(CMAKE_CXX_STANDARD 14)
# BOOST PACKAGE
find_package(Boost REQUIRED COMPONENTS
    atomic
    chrono
    date_time
    exception
    filesystem
    random
    regex
    serialization
    system
    thread
    )
include_directories(${Boost_INCLUDE_DIRS})
IF (!Boost_FOUND)
    MESSAGE("*** ERROR *** Boost package not found")
    RETURN()
ENDIF ()
# Microsoft RESTful API Package (Casablanca)
set(CPPREST_LIBRARIES "/usr/local/opt/openssl/lib")
include_directories("/usr/local/opt/openssl/include")
# Compile and link
# Build the core library and executable
include_directories(${CMAKE_SOURCE_DIR})
set(SOURCE_FILES
    main.cpp
    )
set(LINK_LIBRARIES
    ${Boost_LIBRARIES}
    ${CPPREST_LIBRARIES}
    -lssl
    -lcrypto
    )
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES})
