xref: /freebsd/contrib/libfido2/examples/CMakeLists.txt (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
10afa8e06SEd Maste# Copyright (c) 2018 Yubico AB. All rights reserved.
20afa8e06SEd Maste# Use of this source code is governed by a BSD-style
30afa8e06SEd Maste# license that can be found in the LICENSE file.
4*2ccfa855SEd Maste# SPDX-License-Identifier: BSD-2-Clause
50afa8e06SEd Maste
60afa8e06SEd Mastelist(APPEND COMPAT_SOURCES
70afa8e06SEd Maste	../openbsd-compat/clock_gettime.c
80afa8e06SEd Maste	../openbsd-compat/getopt_long.c
90afa8e06SEd Maste	../openbsd-compat/strlcat.c
100afa8e06SEd Maste	../openbsd-compat/strlcpy.c
110afa8e06SEd Maste)
120afa8e06SEd Maste
130afa8e06SEd Masteif(WIN32 AND BUILD_SHARED_LIBS AND NOT CYGWIN AND NOT MSYS)
140afa8e06SEd Maste	list(APPEND COMPAT_SOURCES ../openbsd-compat/posix_win.c)
150afa8e06SEd Masteendif()
160afa8e06SEd Maste
170afa8e06SEd Maste# enable -Wconversion -Wsign-conversion
180afa8e06SEd Masteif(NOT MSVC)
190afa8e06SEd Maste	set_source_files_properties(assert.c cred.c info.c manifest.c reset.c
200afa8e06SEd Maste	    retries.c setpin.c util.c PROPERTIES COMPILE_FLAGS
210afa8e06SEd Maste	    "-Wconversion -Wsign-conversion")
220afa8e06SEd Masteendif()
230afa8e06SEd Maste
240afa8e06SEd Maste# manifest
250afa8e06SEd Masteadd_executable(manifest manifest.c ${COMPAT_SOURCES})
260afa8e06SEd Mastetarget_link_libraries(manifest ${_FIDO2_LIBRARY})
270afa8e06SEd Maste
280afa8e06SEd Maste# info
290afa8e06SEd Masteadd_executable(info info.c ${COMPAT_SOURCES})
300afa8e06SEd Mastetarget_link_libraries(info ${_FIDO2_LIBRARY})
310afa8e06SEd Maste
320afa8e06SEd Maste# reset
330afa8e06SEd Masteadd_executable(reset reset.c util.c ${COMPAT_SOURCES})
340afa8e06SEd Mastetarget_link_libraries(reset ${_FIDO2_LIBRARY})
350afa8e06SEd Maste
360afa8e06SEd Maste# cred
370afa8e06SEd Masteadd_executable(cred cred.c util.c ${COMPAT_SOURCES})
380afa8e06SEd Mastetarget_link_libraries(cred ${_FIDO2_LIBRARY})
390afa8e06SEd Maste
400afa8e06SEd Maste# assert
410afa8e06SEd Masteadd_executable(assert assert.c util.c ${COMPAT_SOURCES})
420afa8e06SEd Mastetarget_link_libraries(assert ${_FIDO2_LIBRARY})
430afa8e06SEd Maste
440afa8e06SEd Maste# setpin
450afa8e06SEd Masteadd_executable(setpin setpin.c ${COMPAT_SOURCES})
460afa8e06SEd Mastetarget_link_libraries(setpin ${_FIDO2_LIBRARY})
470afa8e06SEd Maste
480afa8e06SEd Maste# retries
490afa8e06SEd Masteadd_executable(retries retries.c ${COMPAT_SOURCES})
500afa8e06SEd Mastetarget_link_libraries(retries ${_FIDO2_LIBRARY})
510afa8e06SEd Maste
520afa8e06SEd Maste# select
530afa8e06SEd Masteadd_executable(select select.c ${COMPAT_SOURCES})
540afa8e06SEd Mastetarget_link_libraries(select ${_FIDO2_LIBRARY})
550afa8e06SEd Maste
560afa8e06SEd Masteif(MINGW)
570afa8e06SEd Maste	# needed for nanosleep() in mingw
580afa8e06SEd Maste	target_link_libraries(select winpthread)
590afa8e06SEd Masteendif()
60