-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
79 lines (69 loc) · 1.87 KB
/
CMakeLists.txt
File metadata and controls
79 lines (69 loc) · 1.87 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
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
cmake_minimum_required(VERSION 3.28)
project(ncrypto VERSION 1.1.3) # x-release-please-version
include(CTest)
include(GNUInstallDirs)
include(cmake/ncrypto-flags.cmake)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
if (NCRYPTO_SHARED_LIBS)
find_package(OpenSSL REQUIRED)
else()
include(FetchContent)
include(cmake/CPM.cmake)
CPMAddPackage(
NAME boringssl
VERSION 0.20250818.0
GITHUB_REPOSITORY google/boringssl
GIT_TAG 0.20250818.0
OPTIONS "BUILD_SHARED_LIBS OFF" "BUILD_TESTING OFF"
)
endif()
add_subdirectory(src)
add_library(ncrypto::ncrypto ALIAS ncrypto)
if (NCRYPTO_TESTING)
if (NCRYPTO_SHARED_LIBS)
find_package(GTest REQUIRED)
else()
CPMAddPackage(
NAME GTest
GITHUB_REPOSITORY google/googletest
VERSION 1.15.2
OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF"
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()
enable_testing()
add_subdirectory(tests)
endif()
install(
FILES include/ncrypto.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT ncrypto_development
)
install(
DIRECTORY include/ncrypto
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT ncrypto_development
)
install(
TARGETS ncrypto
EXPORT ncrypto_targets
RUNTIME COMPONENT ncrypto_runtime
LIBRARY COMPONENT ncrypto_runtime
NAMELINK_COMPONENT ncrypto_development
ARCHIVE COMPONENT ncrypto_development
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
# Generate pkg-config file
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/ncrypto.pc.in
${CMAKE_CURRENT_BINARY_DIR}/ncrypto.pc
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ncrypto.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)