forked from aspnet/SignalR-Client-Cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
81 lines (62 loc) · 2.15 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
cmake_minimum_required (VERSION 3.14)
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
endif()
project (microsoft-signalr)
include(CTest)
set(WERROR true CACHE BOOL "Enable warnings as errors.")
set(WALL true CACHE BOOL "Enable all warnings.")
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
if(NOT WIN32)
set(EXTRA_FLAGS "-std=c++11 -fPIC -DNO_SIGNALRCLIENT_EXPORTS")
else()
set(EXTRA_FLAGS "-DSIGNALRCLIENT_EXPORTS")
endif()
if(USE_MSGPACK)
string(APPEND EXTRA_FLAGS " -DUSE_MSGPACK")
endif()
if(INJECT_HEADER_AFTER_STDAFX)
string(APPEND EXTRA_FLAGS " -DINJECT_HEADER_AFTER_STDAFX=${INJECT_HEADER_AFTER_STDAFX}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LDFLAGS}")
if(USE_CPPRESTSDK)
find_package(cpprestsdk REQUIRED)
set(CPPREST_LIB "cpprestsdk::cpprest")
endif()
find_package(jsoncpp REQUIRED)
# jsoncpp has different target names depending on whether it
# was built as a shared or static library. We make this override-able
# so we can be resilient to the changes between versions.
if(WIN32)
set(JSONCPP_LIB "jsoncpp_lib" CACHE STRING "jsoncpp target name")
else()
set(JSONCPP_LIB "jsoncpp_static" CACHE STRING "jsoncpp target name")
endif()
if(USE_MSGPACK)
find_package(msgpack CONFIG REQUIRED)
set(MSGPACK_LIB "msgpackc-cxx")
endif()
include_directories (include)
if(USE_CPPRESTSDK)
if(NOT WIN32)
if(APPLE)
file(GLOB OPENSSL_ROOT_DIR /usr/local/Cellar/openssl/*)
list(REVERSE OPENSSL_ROOT_DIR)
endif()
find_package(OpenSSL 1.0.0 REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread chrono)
endif()
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
add_subdirectory(src/signalrclient)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
if(BUILD_SAMPLES)
add_subdirectory(samples/HubConnectionSample)
endif()
install(DIRECTORY include/ DESTINATION include/)