-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
66 lines (57 loc) · 2.06 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
cmake_minimum_required (VERSION 2.6.2)
project (cereal-yaml)
if(NOT CMAKE_VERSION VERSION_LESS 3.0) # installing cereal-yaml requires INTERFACE lib
option(JUST_INSTALL_CEREAL_YAML "Don't do anything besides installing the library" OFF)
endif()
option(THREAD_SAFE "Use mutexes to ensure thread safety" OFF)
if(THREAD_SAFE)
add_definitions(-DCEREAL_YAML_THREAD_SAFE=1)
set(CEREAL_YAML_THREAD_LIBS "pthread")
else()
set(CEREAL_YAML_THREAD_LIBS "")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /W3 /WX")
else()
set(CMAKE_CXX_FLAGS "-Wall -g -Wextra -Wshadow -pedantic -Wold-style-cast ${CMAKE_CXX_FLAGS}")
option(WITH_WERROR "Compile with '-Werror' C++ compiler flag" OFF)
if(WITH_WERROR)
set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
endif(WITH_WERROR)
if(CMAKE_VERSION VERSION_LESS 3.1)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
else()
if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD STREQUAL "98")
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
add_library(cereal-yaml INTERFACE)
target_include_directories(cereal-yaml INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(TARGETS cereal-yaml EXPORT cereal-yaml
DESTINATION lib) # ignored
install(EXPORT cereal-yaml FILE cereal-yaml-config.cmake
DESTINATION share/cmake/cereal-yaml)
install(DIRECTORY include/cereal-yaml DESTINATION include)
endif()
if(JUST_INSTALL_CEREAL_YAML)
return()
endif()
include_directories(./include)
include_directories(cereal/include)
include_directories(cereal/unittests)
include_directories(yaml-cpp/include)
add_subdirectory(yaml-cpp)
# Boost serialization for performance sandbox
find_package(Boost COMPONENTS serialization)
if(Boost_FOUND)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)
enable_testing()
add_subdirectory(unittests)
add_subdirectory(example)