-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
77 lines (61 loc) · 1.81 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
cmake_minimum_required(VERSION 3.16)
project(SecretHandshakeCpp)
## NOTE: libSodium is required for building the tests, but not the library itself.
add_subdirectory(vendor/monocypher-cpp)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
if (MSVC)
add_compile_options(/W4) # TODO: Add /WX
else()
add_compile_options(-Wall -Wpedantic -Werror -Wno-unknown-pragmas)
add_compile_definitions(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # stops libc++ headers from including extra headers.
endif()
include_directories(
include
vendor/monocypher-cpp/include
)
#### LIBRARY
add_library( SecretHandshakeCpp STATIC
src/shs.cc
src/SecretHandshake.cc
src/SecretStream.cc
)
target_link_libraries( SecretHandshakeCpp INTERFACE
MonocypherCpp
)
#### TESTS
if(APPLE)
# Just for libSodium, used by shs1.c in the tests
include_directories(SYSTEM PUBLIC
/opt/homebrew/include
/usr/local/include
)
link_directories(
/opt/homebrew/lib
/usr/local/lib
)
endif()
add_executable( SecretHandshakeTests
vendor/monocypher-cpp/tests/tests_main.cc # Include the Monocypher-cpp tests too
vendor/monocypher-cpp/tests/MonocypherCppTests.cc
tests/shsTests.cc
tests/SecretHandshakeTests.cc
tests/SecretHandshakeTests.c
vendor/shs1-c/src/shs1.c
)
if (CMAKE_COMPILER_IS_GNUCC)
set_source_files_properties(
vendor/shs1-c/src/shs1.c PROPERTIES COMPILE_OPTIONS "-Wno-array-parameter"
)
endif()
target_include_directories( SecretHandshakeTests PRIVATE
vendor/shs1-c/src/
vendor/catch2
vendor/monocypher-cpp/tests/
)
target_link_libraries( SecretHandshakeTests PRIVATE
SecretHandshakeCpp
sodium # used by shs1-c
)