1# Copyright (c) 2018-2022 Yubico AB. All rights reserved. 2# Use of this source code is governed by a BSD-style 3# license that can be found in the LICENSE file. 4# SPDX-License-Identifier: BSD-2-Clause 5cmake_minimum_required(VERSION 3.7) 6 7# detect AppleClang; needs to come before project() 8cmake_policy(SET CMP0025 NEW) 9 10project(libfido2 C) 11# Set PIE flags for POSITION_INDEPENDENT_CODE targets, added in CMake 3.14. 12if(POLICY CMP0083) 13 cmake_policy(SET CMP0083 NEW) 14endif() 15 16include(CheckCCompilerFlag) 17include(CheckFunctionExists) 18include(CheckLibraryExists) 19include(CheckSymbolExists) 20include(CheckIncludeFiles) 21include(CheckTypeSize) 22include(GNUInstallDirs) 23include(CheckPIESupported OPTIONAL RESULT_VARIABLE CHECK_PIE_SUPPORTED) 24if(CHECK_PIE_SUPPORTED) 25 check_pie_supported(LANGUAGES C) 26endif() 27 28set(CMAKE_POSITION_INDEPENDENT_CODE ON) 29set(CMAKE_COLOR_MAKEFILE OFF) 30set(CMAKE_VERBOSE_MAKEFILE ON) 31set(FIDO_MAJOR "1") 32set(FIDO_MINOR "14") 33set(FIDO_PATCH "0") 34set(FIDO_VERSION ${FIDO_MAJOR}.${FIDO_MINOR}.${FIDO_PATCH}) 35 36option(BUILD_TESTS "Build the regress tests" ON) 37option(BUILD_EXAMPLES "Build example programs" ON) 38option(BUILD_MANPAGES "Build man pages" ON) 39option(BUILD_SHARED_LIBS "Build a shared library" ON) 40option(BUILD_STATIC_LIBS "Build a static library" ON) 41option(BUILD_TOOLS "Build tool programs" ON) 42option(FUZZ "Enable fuzzing instrumentation" OFF) 43option(USE_HIDAPI "Use hidapi as the HID backend" OFF) 44option(USE_PCSC "Enable experimental PCSC support" OFF) 45option(USE_WINHELLO "Abstract Windows Hello as a FIDO device" ON) 46option(NFC_LINUX "Enable NFC support on Linux" ON) 47 48add_definitions(-D_FIDO_MAJOR=${FIDO_MAJOR}) 49add_definitions(-D_FIDO_MINOR=${FIDO_MINOR}) 50add_definitions(-D_FIDO_PATCH=${FIDO_PATCH}) 51 52if(BUILD_SHARED_LIBS) 53 set(_FIDO2_LIBRARY fido2_shared) 54elseif(BUILD_STATIC_LIBS) 55 set(_FIDO2_LIBRARY fido2) 56else() 57 message(FATAL_ERROR "Nothing to build (BUILD_*_LIBS=OFF)") 58endif() 59 60if(CYGWIN OR MSYS OR MINGW) 61 set(WIN32 1) 62endif() 63 64if(WIN32) 65 add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600) 66endif() 67 68if(APPLE) 69 set(CMAKE_INSTALL_NAME_DIR 70 "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") 71endif() 72 73if(NOT MSVC) 74 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D_POSIX_C_SOURCE=200809L") 75 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D_BSD_SOURCE") 76 if(APPLE) 77 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D_DARWIN_C_SOURCE") 78 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D__STDC_WANT_LIB_EXT1__=1") 79 elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR MINGW OR CYGWIN) 80 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D_GNU_SOURCE") 81 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D_DEFAULT_SOURCE") 82 elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR 83 CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD") 84 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D__BSD_VISIBLE=1") 85 elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") 86 set(FIDO_CFLAGS "${FIDO_CFLAGS} -D_NETBSD_SOURCE") 87 endif() 88 set(FIDO_CFLAGS "${FIDO_CFLAGS} -std=c99") 89 set(CMAKE_C_FLAGS "${FIDO_CFLAGS} ${CMAKE_C_FLAGS}") 90endif() 91 92check_c_compiler_flag("-Wshorten-64-to-32" HAVE_SHORTEN_64_TO_32) 93check_c_compiler_flag("-Werror -fstack-protector-all" HAVE_STACK_PROTECTOR_ALL) 94 95check_include_files(cbor.h HAVE_CBOR_H) 96check_include_files(endian.h HAVE_ENDIAN_H) 97check_include_files(err.h HAVE_ERR_H) 98check_include_files(openssl/opensslv.h HAVE_OPENSSLV_H) 99check_include_files(signal.h HAVE_SIGNAL_H) 100check_include_files(sys/random.h HAVE_SYS_RANDOM_H) 101check_include_files(unistd.h HAVE_UNISTD_H) 102 103check_symbol_exists(arc4random_buf stdlib.h HAVE_ARC4RANDOM_BUF) 104check_symbol_exists(asprintf stdio.h HAVE_ASPRINTF) 105check_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME) 106check_symbol_exists(explicit_bzero string.h HAVE_EXPLICIT_BZERO) 107check_symbol_exists(freezero stdlib.h HAVE_FREEZERO) 108check_symbol_exists(getline stdio.h HAVE_GETLINE) 109check_symbol_exists(getopt unistd.h HAVE_GETOPT) 110check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) 111check_symbol_exists(getrandom sys/random.h HAVE_GETRANDOM) 112check_symbol_exists(memset_s string.h HAVE_MEMSET_S) 113check_symbol_exists(readpassphrase readpassphrase.h HAVE_READPASSPHRASE) 114check_symbol_exists(recallocarray stdlib.h HAVE_RECALLOCARRAY) 115check_symbol_exists(strlcat string.h HAVE_STRLCAT) 116check_symbol_exists(strlcpy string.h HAVE_STRLCPY) 117check_symbol_exists(strsep string.h HAVE_STRSEP) 118check_symbol_exists(sysconf unistd.h HAVE_SYSCONF) 119check_symbol_exists(timespecsub sys/time.h HAVE_TIMESPECSUB) 120check_symbol_exists(timingsafe_bcmp string.h HAVE_TIMINGSAFE_BCMP) 121 122set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 123try_compile(HAVE_POSIX_IOCTL 124 "${CMAKE_CURRENT_BINARY_DIR}/posix_ioctl_check.o" 125 "${CMAKE_CURRENT_SOURCE_DIR}/openbsd-compat/posix_ioctl_check.c" 126 COMPILE_DEFINITIONS "-Werror -Woverflow -Wsign-conversion") 127 128list(APPEND CHECK_VARIABLES 129 HAVE_ARC4RANDOM_BUF 130 HAVE_ASPRINTF 131 HAVE_CBOR_H 132 HAVE_CLOCK_GETTIME 133 HAVE_ENDIAN_H 134 HAVE_ERR_H 135 HAVE_FREEZERO 136 HAVE_GETLINE 137 HAVE_GETOPT 138 HAVE_GETPAGESIZE 139 HAVE_GETRANDOM 140 HAVE_MEMSET_S 141 HAVE_OPENSSLV_H 142 HAVE_POSIX_IOCTL 143 HAVE_READPASSPHRASE 144 HAVE_RECALLOCARRAY 145 HAVE_SIGNAL_H 146 HAVE_STRLCAT 147 HAVE_STRLCPY 148 HAVE_STRSEP 149 HAVE_SYSCONF 150 HAVE_SYS_RANDOM_H 151 HAVE_TIMESPECSUB 152 HAVE_TIMINGSAFE_BCMP 153 HAVE_UNISTD_H 154) 155 156foreach(v ${CHECK_VARIABLES}) 157 if (${v}) 158 add_definitions(-D${v}) 159 endif() 160endforeach() 161 162if(HAVE_EXPLICIT_BZERO AND NOT FUZZ) 163 add_definitions(-DHAVE_EXPLICIT_BZERO) 164endif() 165 166if(UNIX) 167 add_definitions(-DHAVE_DEV_URANDOM) 168endif() 169 170 171if(MSVC) 172 if((NOT CBOR_INCLUDE_DIRS) OR (NOT CBOR_LIBRARY_DIRS) OR 173 (NOT CRYPTO_INCLUDE_DIRS) OR (NOT CRYPTO_LIBRARY_DIRS) OR 174 (NOT ZLIB_INCLUDE_DIRS) OR (NOT ZLIB_LIBRARY_DIRS)) 175 message(FATAL_ERROR "please define " 176 "{CBOR,CRYPTO,ZLIB}_{INCLUDE,LIBRARY}_DIRS when " 177 "building under msvc") 178 endif() 179 if(BUILD_TESTS AND BUILD_SHARED_LIBS AND 180 ((NOT CBOR_BIN_DIRS) OR (NOT ZLIB_BIN_DIRS) OR (NOT CRYPTO_BIN_DIRS))) 181 message(FATAL_ERROR "please define {CBOR,CRYPTO,ZLIB}_BIN_DIRS " 182 "when building tests") 183 endif() 184 if(NOT CBOR_LIBRARIES) 185 set(CBOR_LIBRARIES cbor) 186 endif() 187 if(NOT ZLIB_LIBRARIES) 188 set(ZLIB_LIBRARIES zlib1) 189 endif() 190 if(NOT CRYPTO_LIBRARIES) 191 set(CRYPTO_LIBRARIES crypto) 192 endif() 193 194 set(MSVC_DISABLED_WARNINGS_LIST 195 "C4152" # nonstandard extension used: function/data pointer 196 # conversion in expression; 197 "C4200" # nonstandard extension used: zero-sized array in 198 # struct/union; 199 "C4201" # nonstandard extension used: nameless struct/union; 200 "C4204" # nonstandard extension used: non-constant aggregate 201 # initializer; 202 "C4706" # assignment within conditional expression; 203 "C4996" # The POSIX name for this item is deprecated. Instead, 204 # use the ISO C and C++ conformant name; 205 "C6287" # redundant code: the left and right subexpressions are identical 206 ) 207 # The construction in the following 3 lines was taken from LibreSSL's 208 # CMakeLists.txt. 209 string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR 210 ${MSVC_DISABLED_WARNINGS_LIST}) 211 string(REGEX REPLACE "[/-]W[1234][ ]?" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) 212 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 -WX ${MSVC_DISABLED_WARNINGS_STR}") 213 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Od /Z7 /guard:cf /sdl /RTCcsu") 214 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi /guard:cf /sdl") 215 if(USE_WINHELLO) 216 add_definitions(-DUSE_WINHELLO) 217 endif() 218 set(NFC_LINUX OFF) 219else() 220 include(FindPkgConfig) 221 pkg_search_module(CBOR libcbor) 222 pkg_search_module(CRYPTO libcrypto) 223 pkg_search_module(ZLIB zlib) 224 225 if(NOT CBOR_FOUND AND NOT HAVE_CBOR_H) 226 message(FATAL_ERROR "could not find libcbor") 227 endif() 228 if(NOT CRYPTO_FOUND AND NOT HAVE_OPENSSLV_H) 229 message(FATAL_ERROR "could not find libcrypto") 230 endif() 231 if(NOT ZLIB_FOUND) 232 message(FATAL_ERROR "could not find zlib") 233 endif() 234 235 if(NOT CBOR_LIBRARIES) 236 set(CBOR_LIBRARIES "cbor") 237 endif() 238 if(NOT CRYPTO_LIBRARIES) 239 set(CRYPTO_LIBRARIES "crypto") 240 endif() 241 242 if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 243 pkg_search_module(UDEV libudev REQUIRED) 244 set(UDEV_NAME "udev") 245 # If using hidapi, use hidapi-hidraw. 246 set(HIDAPI_SUFFIX -hidraw) 247 if(NOT HAVE_CLOCK_GETTIME) 248 # Look for clock_gettime in librt. 249 check_library_exists(rt clock_gettime "time.h" 250 HAVE_CLOCK_GETTIME) 251 if (HAVE_CLOCK_GETTIME) 252 add_definitions(-DHAVE_CLOCK_GETTIME) 253 set(BASE_LIBRARIES ${BASE_LIBRARIES} rt) 254 endif() 255 endif() 256 else() 257 set(NFC_LINUX OFF) 258 endif() 259 260 if(MINGW) 261 # MinGW is stuck with a flavour of C89. 262 add_definitions(-DFIDO_NO_DIAGNOSTIC) 263 add_definitions(-DWC_ERR_INVALID_CHARS=0x80) 264 add_compile_options(-Wno-unused-parameter) 265 endif() 266 267 if(FUZZ) 268 set(USE_PCSC ON) 269 add_definitions(-DFIDO_FUZZ) 270 endif() 271 272 # If building with PCSC, look for pcsc-lite. 273 if(USE_PCSC AND NOT (APPLE OR CYGWIN OR MSYS OR MINGW)) 274 pkg_search_module(PCSC libpcsclite REQUIRED) 275 set(PCSC_LIBRARIES pcsclite) 276 endif() 277 278 if(USE_HIDAPI) 279 add_definitions(-DUSE_HIDAPI) 280 pkg_search_module(HIDAPI hidapi${HIDAPI_SUFFIX} REQUIRED) 281 set(HIDAPI_LIBRARIES hidapi${HIDAPI_SUFFIX}) 282 endif() 283 284 if(NFC_LINUX) 285 add_definitions(-DUSE_NFC) 286 endif() 287 288 if(WIN32) 289 if(USE_WINHELLO) 290 add_definitions(-DUSE_WINHELLO) 291 endif() 292 else() 293 set(USE_WINHELLO OFF) 294 endif() 295 296 add_compile_options(-Wall) 297 add_compile_options(-Wextra) 298 add_compile_options(-Werror) 299 add_compile_options(-Wshadow) 300 add_compile_options(-Wcast-qual) 301 add_compile_options(-Wwrite-strings) 302 add_compile_options(-Wmissing-prototypes) 303 add_compile_options(-Wbad-function-cast) 304 add_compile_options(-Wimplicit-fallthrough) 305 add_compile_options(-pedantic) 306 add_compile_options(-pedantic-errors) 307 308 set(EXTRA_CFLAGS "-Wconversion -Wsign-conversion") 309 310 if(WIN32) 311 add_compile_options(-Wno-type-limits) 312 add_compile_options(-Wno-cast-function-type) 313 endif() 314 315 if(HAVE_SHORTEN_64_TO_32) 316 add_compile_options(-Wshorten-64-to-32) 317 endif() 318 319 if(HAVE_STACK_PROTECTOR_ALL) 320 add_compile_options(-fstack-protector-all) 321 endif() 322 323 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g2") 324 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer") 325 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_FORTIFY_SOURCE=2") 326 327 if(CRYPTO_VERSION VERSION_GREATER_EQUAL 3.0) 328 add_definitions(-DOPENSSL_API_COMPAT=0x10100000L) 329 endif() 330 331 if(NOT FUZZ) 332 set(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wframe-larger-than=2047") 333 endif() 334endif() 335 336# Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 337if(CMAKE_COMPILER_IS_GNUCC) 338 add_compile_options(-Wno-unused-result) 339endif() 340 341# Decide which keyword to use for thread-local storage. 342if(CMAKE_COMPILER_IS_GNUCC OR 343 CMAKE_C_COMPILER_ID STREQUAL "Clang" OR 344 CMAKE_C_COMPILER_ID STREQUAL "AppleClang") 345 set(TLS "__thread") 346elseif(WIN32) 347 set(TLS "__declspec(thread)") 348endif() 349add_definitions(-DTLS=${TLS}) 350 351if(USE_PCSC) 352 add_definitions(-DUSE_PCSC) 353endif() 354 355# export list 356if(APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR 357 CMAKE_C_COMPILER_ID STREQUAL "AppleClang")) 358 # clang + lld 359 string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} 360 " -exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/src/export.llvm") 361elseif(NOT MSVC) 362 # clang/gcc + gnu ld 363 if(FUZZ) 364 string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} 365 " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/fuzz/export.gnu") 366 else() 367 string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} 368 " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/export.gnu") 369 endif() 370 if(NOT WIN32) 371 string(CONCAT CMAKE_SHARED_LINKER_FLAGS 372 ${CMAKE_SHARED_LINKER_FLAGS} 373 " -Wl,-z,noexecstack -Wl,-z,relro,-z,now") 374 string(CONCAT CMAKE_EXE_LINKER_FLAGS 375 ${CMAKE_EXE_LINKER_FLAGS} 376 " -Wl,-z,noexecstack -Wl,-z,relro,-z,now") 377 if(FUZZ) 378 file(STRINGS fuzz/wrapped.sym WRAPPED_SYMBOLS) 379 foreach(s ${WRAPPED_SYMBOLS}) 380 string(CONCAT CMAKE_SHARED_LINKER_FLAGS 381 ${CMAKE_SHARED_LINKER_FLAGS} 382 " -Wl,--wrap=${s}") 383 endforeach() 384 endif() 385 endif() 386else() 387 string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} 388 " /def:\"${CMAKE_CURRENT_SOURCE_DIR}/src/export.msvc\"") 389endif() 390 391include_directories(${PROJECT_SOURCE_DIR}/src) 392include_directories(${CBOR_INCLUDE_DIRS}) 393include_directories(${CRYPTO_INCLUDE_DIRS}) 394include_directories(${HIDAPI_INCLUDE_DIRS}) 395include_directories(${PCSC_INCLUDE_DIRS}) 396include_directories(${UDEV_INCLUDE_DIRS}) 397include_directories(${ZLIB_INCLUDE_DIRS}) 398 399link_directories(${CBOR_LIBRARY_DIRS}) 400link_directories(${CRYPTO_LIBRARY_DIRS}) 401link_directories(${HIDAPI_LIBRARY_DIRS}) 402link_directories(${PCSC_LIBRARY_DIRS}) 403link_directories(${UDEV_LIBRARY_DIRS}) 404link_directories(${ZLIB_LIBRARY_DIRS}) 405 406message(STATUS "BASE_LIBRARIES: ${BASE_LIBRARIES}") 407message(STATUS "BUILD_EXAMPLES: ${BUILD_EXAMPLES}") 408message(STATUS "BUILD_MANPAGES: ${BUILD_MANPAGES}") 409message(STATUS "BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") 410message(STATUS "BUILD_STATIC_LIBS: ${BUILD_STATIC_LIBS}") 411message(STATUS "BUILD_TOOLS: ${BUILD_TOOLS}") 412message(STATUS "CBOR_INCLUDE_DIRS: ${CBOR_INCLUDE_DIRS}") 413message(STATUS "CBOR_LIBRARIES: ${CBOR_LIBRARIES}") 414message(STATUS "CBOR_LIBRARY_DIRS: ${CBOR_LIBRARY_DIRS}") 415if(BUILD_TESTS) 416 message(STATUS "CBOR_BIN_DIRS: ${CBOR_BIN_DIRS}") 417endif() 418message(STATUS "CBOR_VERSION: ${CBOR_VERSION}") 419message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") 420message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") 421message(STATUS "CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}") 422message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") 423message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}") 424message(STATUS "CMAKE_GENERATOR_PLATFORM: ${CMAKE_GENERATOR_PLATFORM}") 425message(STATUS "CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}") 426message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}") 427message(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}") 428message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") 429message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") 430message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") 431message(STATUS "CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") 432message(STATUS "CRYPTO_INCLUDE_DIRS: ${CRYPTO_INCLUDE_DIRS}") 433message(STATUS "CRYPTO_LIBRARIES: ${CRYPTO_LIBRARIES}") 434message(STATUS "CRYPTO_LIBRARY_DIRS: ${CRYPTO_LIBRARY_DIRS}") 435if(BUILD_TESTS) 436 message(STATUS "CRYPTO_BIN_DIRS: ${CRYPTO_BIN_DIRS}") 437endif() 438message(STATUS "CRYPTO_VERSION: ${CRYPTO_VERSION}") 439message(STATUS "FIDO_VERSION: ${FIDO_VERSION}") 440message(STATUS "FUZZ: ${FUZZ}") 441if(FUZZ) 442 message(STATUS "FUZZ_LDFLAGS: ${FUZZ_LDFLAGS}") 443endif() 444message(STATUS "ZLIB_INCLUDE_DIRS: ${ZLIB_INCLUDE_DIRS}") 445message(STATUS "ZLIB_LIBRARIES: ${ZLIB_LIBRARIES}") 446message(STATUS "ZLIB_LIBRARY_DIRS: ${ZLIB_LIBRARY_DIRS}") 447if(BUILD_TESTS) 448 message(STATUS "ZLIB_BIN_DIRS: ${ZLIB_BIN_DIRS}") 449endif() 450message(STATUS "ZLIB_VERSION: ${ZLIB_VERSION}") 451if(USE_HIDAPI) 452 message(STATUS "HIDAPI_INCLUDE_DIRS: ${HIDAPI_INCLUDE_DIRS}") 453 message(STATUS "HIDAPI_LIBRARIES: ${HIDAPI_LIBRARIES}") 454 message(STATUS "HIDAPI_LIBRARY_DIRS: ${HIDAPI_LIBRARY_DIRS}") 455 message(STATUS "HIDAPI_VERSION: ${HIDAPI_VERSION}") 456endif() 457message(STATUS "PCSC_INCLUDE_DIRS: ${PCSC_INCLUDE_DIRS}") 458message(STATUS "PCSC_LIBRARIES: ${PCSC_LIBRARIES}") 459message(STATUS "PCSC_LIBRARY_DIRS: ${PCSC_LIBRARY_DIRS}") 460message(STATUS "PCSC_VERSION: ${PCSC_VERSION}") 461message(STATUS "TLS: ${TLS}") 462message(STATUS "UDEV_INCLUDE_DIRS: ${UDEV_INCLUDE_DIRS}") 463message(STATUS "UDEV_LIBRARIES: ${UDEV_LIBRARIES}") 464message(STATUS "UDEV_LIBRARY_DIRS: ${UDEV_LIBRARY_DIRS}") 465message(STATUS "UDEV_RULES_DIR: ${UDEV_RULES_DIR}") 466message(STATUS "UDEV_VERSION: ${UDEV_VERSION}") 467message(STATUS "USE_HIDAPI: ${USE_HIDAPI}") 468message(STATUS "USE_PCSC: ${USE_PCSC}") 469message(STATUS "USE_WINHELLO: ${USE_WINHELLO}") 470message(STATUS "NFC_LINUX: ${NFC_LINUX}") 471 472if(BUILD_TESTS) 473 enable_testing() 474endif() 475 476add_subdirectory(src) 477 478if(BUILD_TESTS) 479 add_subdirectory(regress) 480endif() 481if(BUILD_EXAMPLES) 482 add_subdirectory(examples) 483endif() 484if(BUILD_TOOLS) 485 add_subdirectory(tools) 486endif() 487if(BUILD_MANPAGES) 488 add_subdirectory(man) 489endif() 490 491if(NOT WIN32) 492 if(FUZZ) 493 add_subdirectory(fuzz) 494 endif() 495 if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 496 add_subdirectory(udev) 497 endif() 498endif() 499