-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (40 loc) · 1.7 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
cmake_minimum_required(VERSION 3.10)
project(byte_vector LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
################## byte_vector ##################
### Interface library user project to be linked with
### to include byte_vector.hpp and other headers
add_library(byte_vector INTERFACE)
target_include_directories(byte_vector INTERFACE .)
##################
################## byte_vector_amalgamate ##################
### Squash all source headers in one file byte_vector.hh
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/byte_vector.hh
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${CMAKE_CURRENT_LIST_DIR}/amalgamate.sh ${CMAKE_CURRENT_BINARY_DIR}/byte_vector.hh
DEPENDS
byte_vector.hpp
byte_range.hpp
byte_range_ascii.hpp
byte_range_hex.hpp
)
add_custom_target(byte_vector_amalgamate ALL SOURCES ${CMAKE_CURRENT_BINARY_DIR}/byte_vector.hh)
##################
################## byte_vector_amalgama ##################
### Interface library user project to be linked with to include the only header byte_vector.hh
add_library(byte_vector_amalgama INTERFACE)
target_include_directories(byte_vector_amalgama INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(byte_vector_amalgama byte_vector_amalgamate)
##################
################## byte_vector-demo ##################
### Demonstration executable
add_executable(byte_vector-demo byte_vector-demo.cpp)
target_compile_features(byte_vector-demo PRIVATE cxx_std_17)
target_link_libraries(byte_vector-demo PRIVATE byte_vector_amalgama)
##################
################## Tests ##################
include(CTest)
if(BUILD_TESTING) ## By default CMake provides ON
add_subdirectory(tests)
endif()
##################