forked from smasherprog/rat_lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
110 lines (98 loc) · 2.8 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
cmake_minimum_required(VERSION 3.8)
project(rat_lite)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(BUILD_EXAMPLE ON)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules")
include(CMakeLists-ExternalProjects.txt)
if(WIN32)
set(REMOTE_ACCESS_PLATFORM_INC
include/windows
)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX)
elseif(APPLE)
set(REMOTE_ACCESS_PLATFORM_INC
include/ios
)
else()
set(REMOTE_ACCESS_PLATFORM_INC
include/linux
)
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
endif()
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(LIBJPEGTURBO REQUIRED)
set(COMMON_INCLUDE_DIRS
include
${CMAKE_BINARY_DIR}/bin/include
${OPENSSL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
${LIBJPEGTURBO_INCLUDE_DIRS}
)
include_directories(
${COMMON_INCLUDE_DIRS}
)
add_library(${PROJECT_NAME}
include/RAT.h
src/ClientDriver.cpp
src/ServerDriver.cpp
)
add_dependencies(${PROJECT_NAME} websocket_lite input_lite clipboard_lite screen_capture_lite)
if(WIN32)
target_link_libraries(${PROJECT_NAME} Crypt32 Dwmapi)
elseif(APPLE)
find_library(corefoundation_lib CoreFoundation)
find_library(cocoa_lib Cocoa)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} ${corefoundation_lib} ${cocoa_lib})
else()
find_package(X11 REQUIRED)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} dl ${X11_LIBRARIES} ${X11_Xfixes_LIB} ${X11_XTest_LIB} ${X11_Xinerama_LIB})
endif()
if(${BUILD_SHARED_LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES DEFINE_SYMBOL RAT_LITE_DLL)
endif()
if(WIN32)
set(LIBEXTENSION .lib)
else()
if(${BUILD_SHARED_LIBS})
set(LIBEXTENSION ${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(LIBEXTENSION ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
endif()
if(${BUILD_SHARED_LIBS})
target_link_libraries(${PROJECT_NAME}
${CMAKE_BINARY_DIR}/bin/lib/${CMAKE_SHARED_LIBRARY_PREFIX}websocket_lite${LIBEXTENSION}
${CMAKE_BINARY_DIR}/bin/lib/${CMAKE_SHARED_LIBRARY_PREFIX}input_lite${LIBEXTENSION}
${CMAKE_BINARY_DIR}/bin/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clipboard_lite${LIBEXTENSION}
${CMAKE_BINARY_DIR}/bin/lib/${CMAKE_SHARED_LIBRARY_PREFIX}screen_capture_lite${LIBEXTENSION}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES}
${LIBJPEGTURBO_LIBRARIES}
)
endif()
install (TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
install (FILES
include/RAT.h
include/Logging.h
DESTINATION include
)
if(BUILD_EXAMPLE)
add_subdirectory(src/server)
add_subdirectory(src/client)
endif()
enable_testing()
add_subdirectory(test)