2019-07-05 21:45:30 +03:00
|
|
|
cmake_minimum_required (VERSION 3.5)
|
|
|
|
|
|
|
|
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
|
|
|
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
|
|
|
|
endif()
|
|
|
|
|
2019-04-02 22:14:15 +03:00
|
|
|
project (signalrclient)
|
|
|
|
|
2019-07-05 21:45:30 +03:00
|
|
|
include(CTest)
|
|
|
|
|
2020-04-14 23:05:15 +03:00
|
|
|
set(WERROR true CACHE BOOL "Enable warnings as errors.")
|
|
|
|
set(WALL true CACHE BOOL "Enable all warnings.")
|
2020-05-05 03:40:15 +03:00
|
|
|
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
|
2020-04-14 23:05:15 +03:00
|
|
|
|
2019-07-05 21:45:30 +03:00
|
|
|
if(NOT WIN32)
|
|
|
|
set(EXTRA_FLAGS "-std=c++11 -fPIC -DNO_SIGNALRCLIENT_EXPORTS")
|
|
|
|
else()
|
|
|
|
set(EXTRA_FLAGS "-DSIGNALRCLIENT_EXPORTS")
|
|
|
|
endif()
|
|
|
|
|
2019-11-06 23:49:07 +03:00
|
|
|
if(USE_CPPRESTSDK)
|
|
|
|
string(APPEND EXTRA_FLAGS " -DUSE_CPPRESTSDK")
|
|
|
|
endif()
|
|
|
|
|
2021-01-29 03:51:30 +03:00
|
|
|
if(INJECT_HEADER_AFTER_STDAFX)
|
|
|
|
string(APPEND EXTRA_FLAGS " -DINJECT_HEADER_AFTER_STDAFX=${INJECT_HEADER_AFTER_STDAFX}")
|
|
|
|
endif()
|
|
|
|
|
2019-07-05 21:45:30 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LDFLAGS}")
|
2019-04-02 22:14:15 +03:00
|
|
|
|
2019-11-06 23:49:07 +03:00
|
|
|
if(USE_CPPRESTSDK)
|
|
|
|
find_package(cpprestsdk REQUIRED)
|
|
|
|
set(CPPREST_LIB "cpprestsdk::cpprest")
|
|
|
|
endif()
|
2019-04-02 22:14:15 +03:00
|
|
|
|
2019-07-05 21:45:30 +03:00
|
|
|
include_directories (include)
|
2019-04-02 22:14:15 +03:00
|
|
|
|
2019-07-05 21:45:30 +03:00
|
|
|
# TODO: We shouldn't use this, it makes the dll/lib export all symbols
|
|
|
|
# We need this for testing, but we might just add all the files to the test project manually
|
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
|
|
|
2020-02-05 03:06:57 +03:00
|
|
|
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)
|
2019-07-05 21:45:30 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-04-02 22:14:15 +03:00
|
|
|
|
|
|
|
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)
|
2019-07-05 21:45:30 +03:00
|
|
|
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
|
|
|
|
2019-07-24 19:01:14 +03:00
|
|
|
if(BUILD_SAMPLES)
|
|
|
|
add_subdirectory(samples/HubConnectionSample)
|
|
|
|
endif()
|
|
|
|
|
2019-07-05 21:45:30 +03:00
|
|
|
install(DIRECTORY include/ DESTINATION include/)
|