summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 926e7f2..3cf62e8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -31,11 +31,14 @@ list(APPEND FIDO_SOURCES
31) 31)
32 32
33if(FUZZ) 33if(FUZZ)
34 list(APPEND FIDO_SOURCES ../fuzz/prng.c)
34 list(APPEND FIDO_SOURCES ../fuzz/uniform_random.c) 35 list(APPEND FIDO_SOURCES ../fuzz/uniform_random.c)
35 list(APPEND FIDO_SOURCES ../fuzz/wrap.c) 36 list(APPEND FIDO_SOURCES ../fuzz/wrap.c)
36endif() 37endif()
37 38
38if(WIN32) 39if(USE_HIDAPI)
40 list(APPEND COMPAT_SOURCES hid_hidapi.c)
41elseif(WIN32)
39 list(APPEND COMPAT_SOURCES hid_win.c) 42 list(APPEND COMPAT_SOURCES hid_win.c)
40elseif(APPLE) 43elseif(APPLE)
41 list(APPEND COMPAT_SOURCES hid_osx.c) 44 list(APPEND COMPAT_SOURCES hid_osx.c)
@@ -43,6 +46,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
43 list(APPEND COMPAT_SOURCES hid_linux.c) 46 list(APPEND COMPAT_SOURCES hid_linux.c)
44elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") 47elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
45 list(APPEND COMPAT_SOURCES hid_openbsd.c) 48 list(APPEND COMPAT_SOURCES hid_openbsd.c)
49else()
50 message(FATAL_ERROR "please define a hid backend for your platform")
46endif() 51endif()
47 52
48list(APPEND COMPAT_SOURCES 53list(APPEND COMPAT_SOURCES
@@ -50,13 +55,14 @@ list(APPEND COMPAT_SOURCES
50 ../openbsd-compat/explicit_bzero.c 55 ../openbsd-compat/explicit_bzero.c
51 ../openbsd-compat/explicit_bzero_win32.c 56 ../openbsd-compat/explicit_bzero_win32.c
52 ../openbsd-compat/recallocarray.c 57 ../openbsd-compat/recallocarray.c
58 ../openbsd-compat/strlcat.c
53 ../openbsd-compat/timingsafe_bcmp.c 59 ../openbsd-compat/timingsafe_bcmp.c
54) 60)
55 61
56# static library 62# static library
57add_library(fido2 STATIC ${FIDO_SOURCES} ${COMPAT_SOURCES}) 63add_library(fido2 STATIC ${FIDO_SOURCES} ${COMPAT_SOURCES})
58target_link_libraries(fido2 ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES} 64target_link_libraries(fido2 ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES}
59 ${UDEV_LIBRARIES} ${BASE_LIBRARIES}) 65 ${UDEV_LIBRARIES} ${BASE_LIBRARIES} ${HIDAPI_LIBRARIES})
60if(WIN32) 66if(WIN32)
61 if (MINGW) 67 if (MINGW)
62 target_link_libraries(fido2 wsock32 ws2_32 bcrypt setupapi hid) 68 target_link_libraries(fido2 wsock32 ws2_32 bcrypt setupapi hid)
@@ -74,7 +80,7 @@ install(TARGETS fido2 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
74# dynamic library 80# dynamic library
75add_library(fido2_shared SHARED ${FIDO_SOURCES} ${COMPAT_SOURCES}) 81add_library(fido2_shared SHARED ${FIDO_SOURCES} ${COMPAT_SOURCES})
76target_link_libraries(fido2_shared ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES} 82target_link_libraries(fido2_shared ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES}
77 ${UDEV_LIBRARIES} ${BASE_LIBRARIES}) 83 ${UDEV_LIBRARIES} ${BASE_LIBRARIES} ${HIDAPI_LIBRARIES})
78if(WIN32) 84if(WIN32)
79 if (MINGW) 85 if (MINGW)
80 target_link_libraries(fido2_shared wsock32 ws2_32 bcrypt 86 target_link_libraries(fido2_shared wsock32 ws2_32 bcrypt