-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathCMakeLists.txt
70 lines (61 loc) · 1.51 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
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.0)
project(lews VERSION 1.0.0.0 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_FLAGS "-D__STDC_CONSTANT_MACROS")
IF(MSVC)
SET(CMAKE_CXX_FLAGS "/EHsc")
ENDIF(MSVC)
set(SOURCE
base64.cpp
base64.h
connection.cpp
connection.h
frame.cpp
frame.h
tools.h
websocket.cpp
websocket.h
md5/md5.h
md5/md5.cpp
demo/demo.h
demo/demo.cpp
demo/user.h
demo/user.cpp
)
if(WIN32)
add_definitions(/DWIN32 /DWIN32_LEAN_AND_MEAN /D_UNICODE /DUNICODE)
endif()
if(WIN32)
set(SYSTEM_LIB
WS2_32
)
else()
if(APPLE)
set(SYSTEM_LIB
"-framework Foundation"
"-framework CoreFoundation"
"-framework AppKit"
"-framework IOKit"
"-framework AVFoundation"
)
else()
set(SYSTEM_LIB
)
endif()
endif()
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE} ${SOURCE_LIB})
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${SYSTEM_LIB})
find_package(Libevent CONFIG REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libevent::core libevent::extra libevent::openssl)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_BUILD_TYPE MATCHES "Release")
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE /Zi)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
LINK_FLAGS "/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF"
)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
COMPILE_PDB_NAME ${CMAKE_PROJECT_NAME}
COMPILE_PDB_OUTPUT_DIR ${CMAKE_BINARY_DIR}
)
endif()
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "${CMAKE_PROJECT_NAME}")