-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
57 lines (47 loc) · 1.57 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
cmake_minimum_required(VERSION 2.8)
set(project_name xfinal)
project(${project_name})
#set(CMAKE_BUILD_TYPE Release)
SET(ENABLE_CLIENT_SSL OFF)
SET(ENABLE_BUILDIN_LOG OFF)
#SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /utf-8")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11")
endif ()
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_INSTALL_RPATH "/usr/local/lib:")
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_definitions(-DASIO_STANDALONE)
if(ENABLE_BUILDIN_LOG)
add_definitions(-DENABLE_BUILDIN_LOG)
endif()
if(ENABLE_CLIENT_SSL)
add_definitions(-DXFINAL_ENABLE_CLIENT_SSL)
endif()
if (ENABLE_CLIENT_SSL)
find_package(OpenSSL REQUIRED)
endif()
set(XFINAL ./xfinal/xfinal.hpp main.cpp)
add_executable(${project_name} ${XFINAL})
if(ENABLE_CLIENT_SSL)
include_directories(${CMAKE_SOURCE_DIR}/xfinal ${CMAKE_SOURCE_DIR}/asio/asio/include ${CMAKE_SOURCE_DIR}/xfinal/ghc ${OPENSSL_INCLUDE_DIR})
else()
include_directories(${CMAKE_SOURCE_DIR}/xfinal ${CMAKE_SOURCE_DIR}/asio/asio/include ${CMAKE_SOURCE_DIR}/xfinal/ghc )
endif()
if(ENABLE_CLIENT_SSL)
if(APPLE)
target_link_libraries(${project_name} ${OPENSSL_LIBRARIES} "-framework CoreFoundation")
else()
target_link_libraries(${project_name} uuid ${OPENSSL_LIBRARIES})
endif()
else()
if(APPLE)
target_link_libraries(${project_name} "-framework CoreFoundation")
else()
target_link_libraries(${project_name} uuid)
endif()
endif()
install(TARGETS ${project_name} DESTINATION include)