-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
41 lines (34 loc) · 1.15 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
cmake_minimum_required(VERSION 3.15)
project(bitpacker
VERSION 0.1.0
DESCRIPTION "Bit level serialization"
LANGUAGES C CXX
)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
add_library(bitpacker INTERFACE)
add_library(bitpacker::bitpacker ALIAS bitpacker)
option(BITPACKER_USE_CXX17 "enable C++17 features for bitpacker" ON)
if(BITPACKER_USE_CXX17)
message("Using C++17 bitpacker features...")
target_compile_features(bitpacker INTERFACE cxx_std_17)
else()
message("Using Bitpacker in C++14 mode...")
target_compile_features(bitpacker INTERFACE cxx_std_14)
endif()
target_sources(bitpacker INTERFACE
include/bitpacker/bitpacker.hpp
)
target_include_directories(bitpacker INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
## packaging and testing: probably only want if this is not a sub-project
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
option(ENABLE_TESTING "Enable Test Builds" ON)
if(ENABLE_TESTING)
enable_testing()
message("Building Tests...")
add_subdirectory(tests)
endif()
#add_subdirectory(packaging)
endif()