-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (107 loc) · 4.98 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
#
# MIT License
#
# Copyright (c) 2022 Jan Möller
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
cmake_minimum_required(VERSION 3.20)
project(structural
VERSION 0.3.0
LANGUAGES CXX
)
#############################################################################################################
# Prevent in-source builds
#############################################################################################################
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif ()
#############################################################################################################
# Dependencies
#############################################################################################################
include(cmake/CPM.cmake)
CPMAddPackage("gh:TheLartians/[email protected]")
CPMAddPackage("gh:jan-moeller/[email protected]")
#############################################################################################################
# Build configuration
#############################################################################################################
message(STATUS "------------------------------------------------------------------------------")
message(STATUS " ${PROJECT_NAME} (${PROJECT_VERSION})")
message(STATUS "------------------------------------------------------------------------------")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
#############################################################################################################
# Main library target
#############################################################################################################
add_library(${PROJECT_NAME}
include/structural/basic_inplace_string.hpp
include/structural/bitset.hpp
include/structural/detail/hash_combine.hpp
include/structural/detail/inplace_hash_table.hpp
include/structural/detail/inplace_red_black_tree.hpp
include/structural/detail/inplace_unordered_map_details.hpp
include/structural/detail/split.hpp
include/structural/detail/static_for.hpp
include/structural/detail/string_view_like.hpp
include/structural/detail/to_underlying.hpp
include/structural/detail/trim.hpp
include/structural/detail/tuple_impl.hpp
include/structural/detail/uninitialized_array_details.hpp
include/structural/hash.hpp
include/structural/inplace_map.hpp
include/structural/inplace_set.hpp
include/structural/inplace_string.hpp
include/structural/inplace_unordered_map.hpp
include/structural/inplace_unordered_set.hpp
include/structural/inplace_vector.hpp
include/structural/named_bitset.hpp
include/structural/pair.hpp
include/structural/structural_constant.hpp
include/structural/tuple.hpp
include/structural/uninitialized_array.hpp
)
target_include_directories(
${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)
target_link_libraries(${PROJECT_NAME} PUBLIC
ctrx::ctrx
)
set_target_properties(${PROJECT_NAME} PROPERTIES
LINKER_LANGUAGE CXX
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")
string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION)
packageProject(
NAME ${PROJECT_NAME}
VERSION ${PROJECT_VERSION}
NAMESPACE ${PROJECT_NAME}
BINARY_DIR ${PROJECT_BINARY_DIR}
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
COMPATIBILITY SameMajorVersion
DEPENDENCIES "ctrx 1.2.0"
)