-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
103 lines (90 loc) · 3.01 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
cmake_minimum_required(VERSION 3.15)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
project(
multibase
VERSION 1.0
LANGUAGES CXX)
option(BUILD_TESTING "Build unit tests" ON)
set(CLI11_PRECOMPILED ON)
find_package(Microsoft.GSL CONFIG REQUIRED)
find_package(range-v3 CONFIG REQUIRED)
find_package(magic_enum CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(CLI11 CONFIG REQUIRED)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(libmultibase)
target_include_directories(
libmultibase PUBLIC $<BUILD_INTERFACE:${multibase_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_target_properties(libmultibase PROPERTIES OUTPUT_NAME multibase)
target_link_libraries(libmultibase magic_enum::magic_enum range-v3::range-v3
Microsoft.GSL::GSL fmt::fmt-header-only)
set(MSVC_COMPILE_OPTIONS /W4 /WX /MP /permissive- /analyze /w14640)
set(CLANG_COMPILE_OPTIONS -Werror -Weverything -Wno-padded -Wno-c++98-compat
-Wno-c++98-compat-pedantic -Wno-unknown-pragmas)
set(GNU_COMPILE_OPTIONS
-Wall
-Wextra
-Wshadow
-Wnon-virtual-dtor
-pedantic
-Werror
-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
-Wpedantic
-Wconversion
-Wsign-conversion
-Wmisleading-indentation
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
-Wnull-dereference
-Wuseless-cast
-Wdouble-promotion
-Wformat=2
-ftemplate-backtrace-limit=0
-Wno-unknown-pragmas)
target_compile_options(
libmultibase
PUBLIC $<$<CXX_COMPILER_ID:Clang>:${CLANG_COMPILE_OPTIONS}>
$<$<CXX_COMPILER_ID:GNU>:${GNU_COMPILE_OPTIONS}>
$<$<CXX_COMPILER_ID:MSVC>:${MSVC_COMPILE_OPTIONS}>)
add_executable(multibase)
target_link_libraries(multibase PRIVATE libmultibase CLI11::CLI11)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${multibase_BINARY_DIR}/multibaseConfigVersion.cmake"
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion)
install(
TARGETS libmultibase
EXPORT multibaseTargets
INCLUDES
DESTINATION include
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(
DIRECTORY multibase
DESTINATION include
FILES_MATCHING
PATTERN "*.h")
configure_package_config_file(
"${multibase_SOURCE_DIR}/cmake/multibaseConfig.cmake"
"${multibase_BINARY_DIR}/multibaseConfig.cmake"
INSTALL_DESTINATION share/cmake/multibase)
install(EXPORT multibaseTargets DESTINATION share/cmake/multibase)
install(FILES "${multibase_BINARY_DIR}/multibaseConfigVersion.cmake"
"${multibase_BINARY_DIR}/multibaseConfig.cmake"
DESTINATION share/cmake/multibase)
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(test)
include(CTest)