-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
36 lines (34 loc) · 1.22 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 3.5)
project(cvd++ LANGUAGES CXX)
if (Static)
set (HalfStatic ON)
#set (OPENSSL_USE_STATIC_LIBS TRUE)
endif()
if (UNIX)
find_package(PkgConfig REQUIRED)
pkg_search_module(OPENSSL REQUIRED openssl)
if(NOT OPENSSL_FOUND)
# Error; with REQUIRED, pkg_search_module() will throw an error by it's own
endif()
endif (UNIX)
add_executable(cvd++ main.cpp)
if (WIN32)
set (OPENSSL_VERSION notfound)
include(FindOpenSSL)
if (${OPENSSL_VERSION} STREQUAL notfound)
message(SEND_ERROR "Openssl is requested. If you have installed INCLUDE openssl report here: https://github.com/GribanovIvan/cvd/issues
You can install openssl from https://slproweb.com/products/Win32OpenSSL.html")
endif()
if (HalfStatic)
target_link_libraries(cvd++ wsock32 ws2_32 crypt32 -static)
else()
target_link_libraries(cvd++ wsock32 ws2_32 crypt32)
endif()
GET_FILENAME_COMPONENT(openssl "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]" ABSOLUTE CACHE)
set(OPENSSL_INCLUDE_DIRS "${openssl}/include")
else()
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
endif(WIN32)
target_link_libraries(cvd++ ${OPENSSL_LIBRARIES})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)