-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
40 lines (34 loc) · 1.2 KB
/
CMakeLists.txt
File metadata and controls
40 lines (34 loc) · 1.2 KB
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
cmake_minimum_required(VERSION 3.10)
project(hypervector CXX)
if(${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT})
# install to the build directory by default
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
endif()
option(HYPERVECTOR_BUILD_TESTS "Build test executable(s)" FALSE)
# header-only library
set(HYPERVECTOR_PUBLIC_HEADER
hypervector.h
hypervector_container.h
hypervector_detail.h
hypervector_print.h
hypervector_view.h
)
add_library(hypervector INTERFACE ${HYPERVECTOR_PUBLIC_HEADER})
target_compile_features(hypervector INTERFACE cxx_std_20) # e.g. for std::uninitialized_copy_n
target_include_directories(hypervector INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
set_target_properties(hypervector PROPERTIES
PUBLIC_HEADER "${HYPERVECTOR_PUBLIC_HEADER}"
)
export(TARGETS hypervector FILE hypervector-config.cmake)
install(EXPORT hypervector-config DESTINATION lib/cmake/hypervector)
install(TARGETS hypervector
EXPORT hypervector-config
PUBLIC_HEADER DESTINATION include
)
if(HYPERVECTOR_BUILD_TESTS)
add_executable(hypervector_test hypervector_test.cpp)
target_link_libraries(hypervector_test hypervector)
endif()