-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
70 lines (58 loc) · 2.49 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
cmake_minimum_required(VERSION 2.8)
project(liquidpp)
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
INCLUDE(CheckIncludeFileCXX)
find_package( Boost REQUIRED )
#find_package( Boost REQUIRED COMPONENTS locale system )
include_directories(${Boost_INCLUDE_DIRS})
#find_package(Protobuf)
if (PROTOBUF_FOUND)
set(LIQUIDPP_HAVE_PROTOBUF PROTOBUF_FOUND)
endif (PROTOBUF_FOUND)
if(MSVC)
# We just need the boost::date_time heades not the lib
add_definitions(-DBOOST_ALL_NO_LIB)
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Werror")
endif()
check_include_file_cxx(string_view LIQUIDPP_HAVE_STD_STRING_VIEW)
check_include_file_cxx(experimental/string_view LIQUIDPP_HAVE_STD_EXPERIMENTAL_STRING_VIEW)
check_include_file_cxx(boost/utility/string_view.hpp LIQUIDPP_HAVE_BOOST_STRING_VIEW)
check_include_file_cxx(nonius/nonius_single.hpp LIQUIDPP_HAVE_NONIUS)
check_include_file_cxx(rapidjson/rapidjson.h LIQUIDPP_HAVE_RAPIDJSON)
check_include_file_cxx(boost/container/small_vector.hpp LIQUIDPP_HAVE_BOOST_SMALL_VECTOR)
if (LIQUIDPP_HAVE_STD_STRING_VIEW)
message("using std::string_view")
set(LIQUIDPP_STRING_VIEW_HEADER <string_view>)
set(LIQUIDPP_STRING_VIEW_CLASS std::string_view)
elseif (LIQUIDPP_HAVE_STD_EXPERIMENTAL_STRING_VIEW)
message("using std::experimental::string_view")
set(LIQUIDPP_STRING_VIEW_HEADER <experimental/string_view>)
set(LIQUIDPP_STRING_VIEW_CLASS std::experimental::string_view)
elseif (LIQUIDPP_HAVE_BOOST_STRING_VIEW)
message("using boost::string_view")
set(LIQUIDPP_STRING_VIEW_HEADER <boost/utility/string_view.hpp>)
set(LIQUIDPP_STRING_VIEW_CLASS boost::string_view)
else (LIQUIDPP_HAVE_STD_STRING_VIEW)
message("using boost::string_view (shipped version)")
set(LIQUIDPP_STRING_VIEW_HEADER \"external/string_view.hpp\")
set(LIQUIDPP_STRING_VIEW_CLASS boost::string_view)
endif (LIQUIDPP_HAVE_STD_STRING_VIEW)
if (!LIQUIDPP_HAVE_BOOST_SMALL_VECTOR)
message("boost::container::small_vector is not available (using std::vector instead)")
endif(!LIQUIDPP_HAVE_BOOST_SMALL_VECTOR)
add_subdirectory (src)
enable_testing()
add_subdirectory (test)
if (LIQUIDPP_HAVE_NONIUS)
add_subdirectory (benchmark)
else (LIQUIDPP_HAVE_NONIUS)
message("not building benchmarks (nonius library is missing)")
endif (LIQUIDPP_HAVE_NONIUS)