@@ -37,6 +37,7 @@ option(BUILD_MANPAGES "Build man pages" ON)
37
37
option (BUILD_SHARED_LIBS "Build a shared library" ON )
38
38
option (BUILD_STATIC_LIBS "Build a static library" ON )
39
39
option (BUILD_TOOLS "Build tool programs" ON )
40
+ option (BUILD_TESTS "Build test programs" OFF )
40
41
option (FUZZ "Enable fuzzing instrumentation" OFF )
41
42
option (LIBFUZZER "Build libfuzzer harnesses" OFF )
42
43
option (USE_HIDAPI "Use hidapi as the HID backend" OFF )
@@ -70,6 +71,9 @@ if(NOT MSVC)
70
71
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
71
72
set (FIDO_CFLAGS "${FIDO_CFLAGS} -D_GNU_SOURCE" )
72
73
set (FIDO_CFLAGS "${FIDO_CFLAGS} -D_DEFAULT_SOURCE" )
74
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Android" )
75
+ set (FIDO_CFLAGS "${FIDO_CFLAGS} -D_GNU_SOURCE" )
76
+ set (FIDO_CFLAGS "${FIDO_CFLAGS} -D_DEFAULT_SOURCE" )
73
77
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
74
78
CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD" )
75
79
set (FIDO_CFLAGS "${FIDO_CFLAGS} -D__BSD_VISIBLE=1" )
@@ -110,6 +114,11 @@ check_symbol_exists(sysconf unistd.h HAVE_SYSCONF)
110
114
check_symbol_exists(timespecsub sys/time.h HAVE_TIMESPECSUB)
111
115
check_symbol_exists(timingsafe_bcmp string .h HAVE_TIMINGSAFE_BCMP)
112
116
117
+ if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
118
+ set (HAVE_EXPLICIT_BZERO OFF )
119
+ add_definitions (-DCRYPTO_EXPLICIT_BZERO)
120
+ endif ()
121
+
113
122
set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
114
123
try_compile (HAVE_POSIX_IOCTL
115
124
"${CMAKE_CURRENT_BINARY_DIR} /posix_ioctl_check.o"
@@ -212,6 +221,7 @@ else()
212
221
message (FATAL_ERROR "could not find zlib" )
213
222
endif ()
214
223
224
+ set (ZLIB_LIBRARIES "zlib" )
215
225
set (CBOR_LIBRARIES "cbor" )
216
226
set (CRYPTO_LIBRARIES "crypto" )
217
227
@@ -229,6 +239,23 @@ else()
229
239
set (BASE_LIBRARIES ${BASE_LIBRARIES} rt)
230
240
endif ()
231
241
endif ()
242
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Android" )
243
+ if (UDEV_ROOT_DIR)
244
+ list (PREPEND CMAKE_FIND_ROOT_PATH ${UDEV_ROOT_DIR} )
245
+ endif ()
246
+
247
+ find_path (UDEV_INCLUDE_DIR
248
+ NAMES "libudev.h" )
249
+
250
+ find_library (UDEV_LIBRARY
251
+ NAMES libudev-zero.a libudev)
252
+
253
+ add_library (udev STATIC IMPORTED GLOBAL )
254
+ set_target_properties (udev PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${UDEV_INCLUDE_DIR} " )
255
+ set_target_properties (udev PROPERTIES IMPORTED_LOCATION "${UDEV_LIBRARY} " )
256
+
257
+ set (UDEV_INCLUDE_DIRS "${UDEV_INCLUDE_DIR} " )
258
+ set (UDEV_LIBRARIES "udev" )
232
259
else ()
233
260
set (NFC_LINUX OFF )
234
261
endif ()
@@ -436,10 +463,13 @@ else()
436
463
message (FATAL_ERROR "Nothing to build (BUILD_*_LIBS=OFF)" )
437
464
endif ()
438
465
439
- enable_testing ()
440
-
441
466
subdirs (src)
442
- subdirs (regress)
467
+
468
+ if (BUILD_TESTS)
469
+ enable_testing ()
470
+ subdirs (regress)
471
+ endif ()
472
+
443
473
if (BUILD_EXAMPLES)
444
474
subdirs (examples)
445
475
endif ()
0 commit comments