forked from jamboree/CxxFunctionBenchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
142 lines (111 loc) · 3.34 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
project(CxxFunctionBenchmark CXX)
cmake_minimum_required(VERSION 3.2)
if(NOT DEFINED CMAKE_CXX_STANDARD)
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
set(CMAKE_CXX_STANDARD 14)
message("# setting CMAKE_CXX_STANDARD to ${CMAKE_CXX_STANDARD}")
else()
include(highest_supp_cmake_cxx_standard.cmake)
list_of_supp_cmake_cxx_stds(lst_supp_cxx_stds)
message("# CXX standards supported by currently running cmake (found via command: cmake --help-property CXX_STANDARD): ${lst_supp_cxx_stds}")
highest_supp_cmake_cxx_standard(hightest_cxx_std)
set(CMAKE_CXX_STANDARD ${hightest_cxx_std})
message("# setting CMAKE_CXX_STANDARD to hightest supported by your compiler: ${hightest_cxx_std}")
endif()
endif()
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
message("# setting CMAKE_CXX_EXTENSIONS to ${CMAKE_CXX_EXTENSIONS}")
endif()
if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message("# setting CMAKE_BUILD_TYPE to ${CMAKE_BUILD_TYPE}")
endif()
include_directories(SYSTEM clugston_styled) # ignore warnings from FastDelegate.h and FastFunc.hpp
option(CLUGSTON "Include Clugston's FastDelegate" OFF)
if (CLUGSTON)
add_definitions(-DCLUGSTON)
endif()
option(SSVU "Include ssvu::FastFunc" OFF)
if (SSVU)
add_definitions(-DSSVU)
endif()
option(BDE "Include Bloomberg BDE" OFF)
if (BDE)
find_package(Git)
execute_process (COMMAND ${GIT_EXECUTABLE} submodule update --recursive --init
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_definitions(-DADD_BDE)
endif()
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PLATFORM 64)
else()
set(PLATFORM 32)
endif()
if(MSVC)
if(PLATFORM EQUAL 64)
add_definitions("-D_WIN64")
else()
# ...
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
set(BOOST_DEBUG ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
if(DEFINED ENV{BOOST_ROOT})
set(BOOST_ROOT $ENV{BOOST_ROOT})
list(APPEND BOOST_LIBRARYDIR
${BOOST_ROOT}/lib${PLATFORM}-msvc-14.1
${BOOST_ROOT}/lib${PLATFORM}-msvc-14.0)
else()
message(FATAL_ERROR "No BOOST_ROOT environment variable could be found! Please make sure it is set and the points to your Boost installation.")
endif()
else()
# Enable full warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
endif()
find_package(Boost 1.55 REQUIRED)
add_library(base INTERFACE)
target_include_directories(base
INTERFACE
${CMAKE_CURRENT_LIST_DIR})
target_compile_features(base
INTERFACE
cxx_alias_templates
cxx_auto_type
cxx_constexpr
cxx_decltype
cxx_decltype_auto
cxx_final
cxx_lambdas
cxx_lambda_init_captures
cxx_generic_lambdas
cxx_variadic_templates
cxx_defaulted_functions
cxx_nullptr
cxx_trailing_return_types
cxx_return_type_deduction)
target_link_libraries(base
INTERFACE
Boost::boost)
if (BDE)
add_subdirectory(bde)
endif()
file(GLOB HEADER *.hpp *.h)
add_executable(overload
${CMAKE_CURRENT_SOURCE_DIR}/overload.cpp)
target_link_libraries(overload
PUBLIC
base)
add_executable(various
${HEADER}
${CMAKE_CURRENT_SOURCE_DIR}/various.cpp)
target_link_libraries(various
PUBLIC
base)
if (BDE)
target_link_libraries(various
PUBLIC
bsls1 bslma1 bslscm1 bslstl1)
endif()