-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
57 lines (44 loc) · 1.75 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
cmake_minimum_required(VERSION 3.12)
project(bn256 VERSION 2.0.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall)
option(BN256_ENABLE_TEST "BN256_ENABLE_TEST" ON)
option(BN256_ENABLE_BMI2 "enable bmi2 intruction set, only for supported x86-64 targets" OFF)
add_subdirectory(src)
if(BN256_ENABLE_TEST)
enable_testing()
add_subdirectory(third-party/Catch2)
add_subdirectory(test)
endif()
include(GNUInstallDirs)
set_property(TARGET bn256 PROPERTY VERSION ${bn256_VERSION})
set_property(TARGET bn256 PROPERTY SOVERSION ${bn256_VERSION_MAJOR})
set_property(TARGET bn256 PROPERTY INTERFACE_bn256_MAJOR_VERSION ${bn256_VERSION_MAJOR})
set_property(TARGET bn256 APPEND PROPERTY COMPATIBLE_INTERFACE_STRING bn256_MAJOR_VERSION)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY third-party/span/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bn256)
install(TARGETS bn256
EXPORT bn256
LIBRARY
ARCHIVE)
install(EXPORT bn256
DESTINATION "lib/cmake/bn256"
FILE bn256-targets.cmake)
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/bn256-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/bn256
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/bn256-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/bn256-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/bn256
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/bn256-config-version.cmake"
VERSION "${bn256_VERSION}"
COMPATIBILITY AnyNewerVersion
)
export(TARGETS bn256 FILE "${CMAKE_CURRENT_BINARY_DIR}/bn256-targets.cmake")