]> the.earth.li Git - onak.git/blobdiff - CMakeLists.txt
Fix issues found by llvm scan-build static analysis
[onak.git] / CMakeLists.txt
index 87f34a57c8f3fe911e0b2aa6a41165a79e7bde87..f755cf4e6348195ee88af1278c2feea46f5cdc25 100644 (file)
@@ -1,6 +1,7 @@
 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-project(onak VERSION 0.6.0 LANGUAGES C)
+project(onak VERSION 0.6.2 LANGUAGES C)
 
+include(CheckSymbolExists)
 include(FindPkgConfig)
 include(GNUInstallDirs)
 include(TestBigEndian)
@@ -35,9 +36,9 @@ endif()
 
 # Core objects
 add_library(libonak STATIC armor.c charfuncs.c cleankey.c cleanup.c decodekey.c
-       getcgi.c hash.c keyarray.c keyid.c keyindex.c ll.c log.c marshal.c
-       mem.c merge.c onak-conf.c parsekey.c photoid.c rsa.c sigcheck.c sendsync.c
-       sha1x.c wordlist.c)
+       getcgi.c hash.c hash-helper.c key-store.c keyarray.c keyid.c keyindex.c
+       ll.c log.c marshal.c mem.c merge.c onak-conf.c parsekey.c photoid.c
+       rsa.c sigcheck.c sendsync.c sha1x.c wordlist.c)
 set(LIBONAK_LIBRARIES "")
 
 # Ideally use Nettle, fall back to our own md5/sha1 routines otherwise
@@ -60,6 +61,13 @@ if (GMP_FOUND)
        target_include_directories(libonak SYSTEM PUBLIC
                        ${GMP_INCLUDE_DIRS} ${HOGWEED_INCLUDE_DIRS})
        LIST(APPEND LIBONAK_LIBRARIES ${GMP_LIBRARY} ${HOGWEED_LIBRARIES})
+
+       set(CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIRS})
+       set(CMAKE_REQUIRED_LIBRARIES ${NETTLE_LIBRARIES} ${HOGWEED_LIBRARIES})
+       # API change in later version of Nettle
+       CHECK_SYMBOL_EXISTS(nettle_get_secp_256r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_256R1)
+       CHECK_SYMBOL_EXISTS(nettle_get_secp_384r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_384R1)
+       CHECK_SYMBOL_EXISTS(nettle_get_secp_521r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_521R1)
 endif()
 
 # Build files that have substitutions in them