-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
76 lines (57 loc) · 1.99 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
project(
"airdcpp-webapi"
DESCRIPTION "AirDC++ Web API"
)
cmake_minimum_required(VERSION 3.16)
# ######### General setup ##########
find_package (websocketpp REQUIRED)
find_package (nlohmann_json 3.0.0 REQUIRED)
file (GLOB_RECURSE webapi_hdrs ${PROJECT_SOURCE_DIR}/*.h)
file (GLOB_RECURSE webapi_srcs ${PROJECT_SOURCE_DIR}/*.cpp ${PROJECT_SOURCE_DIR}/*.c)
add_library (${PROJECT_NAME} ${webapi_srcs} ${webapi_hdrs} )
# Project file generation
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${webapi_srcs})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${webapi_hdrs})
target_include_directories(${PROJECT_NAME}
#PUBLIC
# ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
# where top-level project will look for the library's public headers
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
# where external projects will look for the library's public headers
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-D_DEBUG)
endif()
if (WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
"_UNICODE"
"UNICODE"
)
target_link_libraries (${PROJECT_NAME}
bcrypt # for Boost::uuid
)
# C1128 number of sections exceeded object file format limit: compile with /bigobj (WebServerManager.cpp)
target_compile_options(${PROJECT_NAME} PRIVATE "/bigobj")
endif()
target_link_libraries (${PROJECT_NAME}
airdcpp
websocketpp::websocketpp
nlohmann_json::nlohmann_json
)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${VERSION} OUTPUT_NAME "airdcpp-webapi")
target_precompile_headers(${PROJECT_NAME} PUBLIC
"$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/stdinc.h>"
"$<$<COMPILE_LANGUAGE:CXX>:<airdcpp/stdinc.h$<ANGLE-R>>"
)
if (APPLE)
set (LIBDIR1 .)
set (LIBDIR ${PROJECT_NAME_GLOBAL}.app/Contents/MacOS)
endif(APPLE)
if (BUILD_SHARED_LIBS)
install (TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION "${LIBDIR}" NAMELINK_SKIP
BUNDLE DESTINATION ${LIBDIR1})
endif ()