blob: 56f2c2a85f34543497831daf22148a184cac142b [file] [log] [blame]
Ed Tanous0fdddb12017-02-28 11:06:34 -08001cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
2
3cmake_policy(SET CMP0054 OLD)
4
5set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
6
7message("${CMAKE_MODULE_PATH}")
8
9#set(HUNTER_ROOT /home/ed/hunter)
10SET(HUNTER_STATUS_DEBUG ON)
11include("cmake/HunterGate.cmake")
12
13HunterGate(
14 URL "https://github.com/ruslo/hunter/archive/v0.16.31.tar.gz"
15 SHA1 "8fcc0a2d6206e1f2c6fc011e3e694e388d030b53"
16)
17
18option(BUILD_FOR_EMBEDDED "Build for device target" ON)
19
20project(bmc-webserver CXX C)
21
22set(CMAKE_CXX_STANDARD 14)
23set(CMAKE_CXX_STANDARD_REQUIRED ON)
24
25set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
26
27if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
28 message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (usually called build) and run CMake from there. You may need to remove CMakeCache.txt." )
29endif()
30
31# general
32option(BUILD_SHARED_LIBS "Build Pion as shared library" OFF)
33option(BUILD_UT "Enable Unit test" OFF)
34
35# Boost
36add_definitions(-DBOOST_ALL_NO_LIB)
37set(Boost_USE_STATIC_LIBS ON)
38hunter_add_package(Boost COMPONENTS system thread regex)
39find_package(Boost COMPONENTS system thread regex REQUIRED)
40
41#Openssl
42hunter_add_package(OpenSSL)
43find_package(OpenSSL REQUIRED)
44if (NOT OPENSSL_FOUND)
45 message(FATAL_ERROR "Could not find OpenSSL")
46endif()
47include_directories(${OPENSSL_INCLUDE_DIR})
48
49# Crow
50include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/crow/include)
51
52#g3 logging
53set(ADD_FATAL_EXAMPLE OFF)
54add_subdirectory(g3log)
55include_directories(g3log/src)
56
57# Debug sanitizers
58find_package(Sanitizers)
59
60# Executable
61add_executable(example ${CMAKE_CURRENT_SOURCE_DIR}/src/example.cpp)
62#target_link_libraries(example crow)
63target_link_libraries(example Boost::boost Boost::system)
64target_link_libraries(example ${CMAKE_THREAD_LIBS_INIT})
65target_link_libraries(example OpenSSL::SSL OpenSSL::Crypto)
66target_link_libraries(example g3logger)
67
68