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