-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
94 lines (66 loc) · 3.31 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
#---------------------------------------------------------------------------#
# Copyright (c) 2018-2020 Mikhail Komarov <[email protected]>
#
# Distributed under the Boost Software License, Version 1.0
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#
cmake_minimum_required(VERSION 3.12.4)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0077 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake"
"${CMAKE_CURRENT_LIST_DIR}/cmake/packages"
"${CMAKE_CURRENT_LIST_DIR}/cmake/modules/share/modules/cmake")
include(CMConfig)
include(CMDeploy)
include(CMSetupVersion)
if(NOT CMAKE_WORKSPACE_NAME OR NOT ("${CMAKE_WORKSPACE_NAME}" STREQUAL "crypto3"))
cm_workspace(crypto3)
endif()
cm_project(codec WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)
if((NOT Boost_CONTAINER_FOUND OR NOT Boost_FOUND) AND NOT CMAKE_CROSSCOMPILING)
find_package(Boost COMPONENTS REQUIRED container)
endif()
option(CRYPTO3_CODEC_BASE58 "Build unit tests" TRUE)
set(BUILD_WITH_CONFIGURATION_FILE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE STRING "Directory for build.hpp lookup")
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
include/nil/crypto3/codec/detail/base_policy.hpp
include/nil/crypto3/codec/detail/hex_policy.hpp
include/nil/crypto3/detail/exploder.hpp
include/nil/crypto3/detail/unbounded_shift.hpp
include/nil/crypto3/detail/imploder.hpp
include/nil/crypto3/detail/stream_endian.hpp
include/nil/crypto3/codec/codec_value.hpp
include/nil/crypto3/codec/codec_state.hpp
include/nil/crypto3/codec/hex.hpp
include/nil/crypto3/codec/base.hpp
include/nil/crypto3/codec/algorithm/encode.hpp
include/nil/crypto3/codec/algorithm/decode.hpp
include/nil/crypto3/codec/adaptor/coded.hpp)
list(APPEND ${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES)
list(APPEND ${CURRENT_PROJECT_NAME}_HEADERS
${${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES})
cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
if(CRYPTO3_CODEC_BASE58)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE CRYPTO3_CODEC_BASE58)
endif()
set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})
target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<$<BOOL:${CRYPTO3_CODEC_BASE58}>:${CMAKE_WORKSPACE_NAME}::multiprecision>
${Boost_LIBRARIES})
target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
${Boost_INCLUDE_DIRS})
cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
include(CMTest)
cm_add_test_subdirectory(test)