xref: /freebsd/contrib/libfido2/examples/CMakeLists.txt (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1# Copyright (c) 2018 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
6list(APPEND COMPAT_SOURCES
7	../openbsd-compat/clock_gettime.c
8	../openbsd-compat/getopt_long.c
9	../openbsd-compat/strlcat.c
10	../openbsd-compat/strlcpy.c
11)
12
13if(WIN32 AND BUILD_SHARED_LIBS AND NOT CYGWIN AND NOT MSYS)
14	list(APPEND COMPAT_SOURCES ../openbsd-compat/posix_win.c)
15endif()
16
17# enable -Wconversion -Wsign-conversion
18if(NOT MSVC)
19	set_source_files_properties(assert.c cred.c info.c manifest.c reset.c
20	    retries.c setpin.c util.c PROPERTIES COMPILE_FLAGS
21	    "-Wconversion -Wsign-conversion")
22endif()
23
24# manifest
25add_executable(manifest manifest.c ${COMPAT_SOURCES})
26target_link_libraries(manifest ${_FIDO2_LIBRARY})
27
28# info
29add_executable(info info.c ${COMPAT_SOURCES})
30target_link_libraries(info ${_FIDO2_LIBRARY})
31
32# reset
33add_executable(reset reset.c util.c ${COMPAT_SOURCES})
34target_link_libraries(reset ${_FIDO2_LIBRARY})
35
36# cred
37add_executable(cred cred.c util.c ${COMPAT_SOURCES})
38target_link_libraries(cred ${_FIDO2_LIBRARY})
39
40# assert
41add_executable(assert assert.c util.c ${COMPAT_SOURCES})
42target_link_libraries(assert ${_FIDO2_LIBRARY})
43
44# setpin
45add_executable(setpin setpin.c ${COMPAT_SOURCES})
46target_link_libraries(setpin ${_FIDO2_LIBRARY})
47
48# retries
49add_executable(retries retries.c ${COMPAT_SOURCES})
50target_link_libraries(retries ${_FIDO2_LIBRARY})
51
52# select
53add_executable(select select.c ${COMPAT_SOURCES})
54target_link_libraries(select ${_FIDO2_LIBRARY})
55
56if(MINGW)
57	# needed for nanosleep() in mingw
58	target_link_libraries(select winpthread)
59endif()
60