-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
83 lines (68 loc) · 2.19 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
# CMakeLists.txt - cmake build for goosig
# Copyright (c) 2020, Christopher Jeffrey (MIT License).
# https://github.com/handshake-org/goosig
cmake_minimum_required(VERSION 3.4)
project(goosig LANGUAGES C)
include(CheckLibraryExists)
include(TestBigEndian)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
option(GOO_ENABLE_GMP "Use gmp if available" ON)
set(goo_sources src/goo/drbg.c
src/goo/goo.c
src/goo/hmac.c
src/goo/sha256.c)
set(goo_defines)
set(goo_cflags)
set(goo_libs)
if(MSVC)
list(APPEND goo_cflags /wd4146
/wd4244
/wd4267
/wd4334)
else()
list(APPEND goo_cflags -pedantic
-Wall
-Wextra
-Wcast-align
-Wno-long-long
-Wshadow)
endif()
check_library_exists(gmp __gmpz_jacobi "" GOO_HAS_GMP)
if(GOO_ENABLE_GMP AND GOO_HAS_GMP)
list(APPEND goo_defines GOO_HAS_GMP)
list(APPEND goo_libs gmp)
else()
list(APPEND goo_sources src/goo/mini-gmp.c)
if(NOT MSVC)
list(APPEND goo_cflags -Wno-unused-parameter
-Wno-unused-variable
-Wno-sign-compare)
endif()
endif()
test_big_endian(GOO_BIGENDIAN)
if(GOO_BIGENDIAN)
list(APPEND goo_defines WORDS_BIGENDIAN)
endif()
add_node_library(goo STATIC ${goo_sources})
target_compile_definitions(goo PRIVATE ${goo_defines})
target_compile_options(goo PRIVATE ${goo_cflags})
target_link_libraries(goo INTERFACE ${goo_libs})
set_property(TARGET goo PROPERTY C_VISIBILITY_PRESET default)
set_property(TARGET goo PROPERTY C_STANDARD_REQUIRED ON)
set_property(TARGET goo PROPERTY C_EXTENSIONS OFF)
set_property(TARGET goo PROPERTY C_STANDARD 90)
set(goosig_cflags)
if(MSVC)
list(APPEND goosig_cflags /wd4146
/wd4244
/wd4267
/wd4334)
else()
list(APPEND goosig_cflags -Wall
-Wextra)
endif()
add_node_module(goosig src/goosig.c)
target_compile_options(goosig PRIVATE ${goosig_cflags})
target_link_libraries(goosig PRIVATE goo)