-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
98 lines (82 loc) · 2.89 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
cmake_minimum_required(VERSION 3.16)
message(STATUS "CMake version ${CMAKE_VERSION}")
project(HermesBDD VERSION 0.1)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20)
message(FATAL_ERROR "MSVC version must be at least 19.20!")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.2)
message(FATAL_ERROR "GCC version must be at least 10.2!")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
message(FATAL_ERROR "Clang version must be at least 11.0!")
endif()
else()
message(WARNING "You are using an unsupported compiler! Compilation has
only been tested with Clang, GCC and MSVC.")
endif()
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(LIBRARY_KIND STATIC)
else()
set(LIBRARY_KIND SHARED)
endif()
set(CMAKE_MACOSX_RPATH 1)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT WIN32)
set(ANY_TARGET_WARN extra pedantic sign-conversion cast-qual disabled-optimization
init-self missing-include-dirs sign-promo switch-default undef redundant-decls
strict-aliasing unused-parameter shadow error)
foreach(WARN ${ANY_TARGET_WARN})
add_compile_options(-W${WARN})
endforeach()
else()
add_compile_options(/WX)
endif()
find_package(Threads REQUIRED)
option(COVERAGE "Enable coverage reporting" OFF)
add_library(coverage_config INTERFACE)
if(COVERAGE)
message(STATUS "Enabled coverage reporting")
target_compile_options(coverage_config INTERFACE -O0 -g --coverage)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(coverage_config INTERFACE --coverage)
else()
target_link_libraries(coverage_config INTERFACE --coverage)
endif()
endif()
option(NO_CACHE "Do not use cache" OFF)
if(NO_CACHE)
MESSAGE(STATUS "NO_CACHE enabled")
add_definitions(-DNO_CACHE)
endif()
option(NO_THREAD "Do not use thread" OFF)
if(NO_THREAD)
MESSAGE(STATUS "NO_THREAD enabled")
add_definitions(-DNO_THREAD)
endif()
option(NO_DYNMEM "Do not use dynamic memory allocation" ON)
if(NO_DYNMEM)
MESSAGE(STATUS "NO_DYNMEM enabled")
add_definitions(-DNO_DYNMEM)
endif()
enable_testing()
include(CTest)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/utils)
include_directories(${PROJECT_SOURCE_DIR}/include)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(profile)
add_library(hermesbdd ${LIBRARY_KIND} $<TARGET_OBJECTS:hermesbdd-all>)
target_link_libraries(hermesbdd ${CMAKE_THREAD_LIBS_INIT})
if(COVERAGE)
target_link_libraries(hermesbdd coverage_config)
endif()
install(TARGETS hermesbdd DESTINATION lib)
install(DIRECTORY include/ DESTINATION include/hermesbdd FILES_MATCHING PATTERN "*.hpp")