I want to statically link the libraries listed below:
set_target_properties(exec PROPERTIES LINK_SEARCH_START_STATIC 1)
set_target_properties(exec PROPER
The CMake documentation starting with version 3.4 on the FindOpenSSL page says:
Set OPENSSL_USE_STATIC_LIBS to TRUE to look for static libraries.
(Assuming if they are found they will be used)
Example:
cmake_minimum_required(VERSION 3.4)
project(Foo)
set(SOURCE_FILES main.cpp)
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} OpenSSL::Crypto)