@@ -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" ON )
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"
@@ -229,6 +238,23 @@ else()
229
238
set (BASE_LIBRARIES ${BASE_LIBRARIES} rt)
230
239
endif ()
231
240
endif ()
241
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Android" )
242
+ if (UDEV_ROOT_DIR)
243
+ list (PREPEND CMAKE_FIND_ROOT_PATH ${UDEV_ROOT_DIR} )
244
+ endif ()
245
+
246
+ find_path (UDEV_INCLUDE_DIR
247
+ NAMES "libudev.h" )
248
+
249
+ find_library (UDEV_LIBRARY
250
+ NAMES libudev-zero.a libudev)
251
+
252
+ add_library (udev STATIC IMPORTED GLOBAL )
253
+ set_target_properties (udev PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${UDEV_INCLUDE_DIR} " )
254
+ set_target_properties (udev PROPERTIES IMPORTED_LOCATION "${UDEV_LIBRARY} " )
255
+
256
+ set (UDEV_INCLUDE_DIRS "${UDEV_INCLUDE_DIR} " )
257
+ set (UDEV_LIBRARIES "udev" )
232
258
else ()
233
259
set (NFC_LINUX OFF )
234
260
endif ()
@@ -436,10 +462,13 @@ else()
436
462
message (FATAL_ERROR "Nothing to build (BUILD_*_LIBS=OFF)" )
437
463
endif ()
438
464
439
- enable_testing ()
440
-
441
465
subdirs (src)
442
- subdirs (regress)
466
+
467
+ if (BUILD_TESTS)
468
+ enable_testing ()
469
+ subdirs (regress)
470
+ endif ()
471
+
443
472
if (BUILD_EXAMPLES)
444
473
subdirs (examples)
445
474
endif ()
0 commit comments