xref: /freebsd/contrib/libfido2/tools/CMakeLists.txt (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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
6list(APPEND COMPAT_SOURCES
7	../openbsd-compat/bsd-getpagesize.c
8	../openbsd-compat/explicit_bzero.c
9	../openbsd-compat/freezero.c
10	../openbsd-compat/recallocarray.c
11	../openbsd-compat/strlcat.c
12	../openbsd-compat/strlcpy.c
13	../openbsd-compat/strsep.c
14)
15
16if(WIN32 AND NOT CYGWIN AND NOT MSYS)
17	list(APPEND COMPAT_SOURCES
18		../openbsd-compat/bsd-getline.c
19		../openbsd-compat/endian_win32.c
20		../openbsd-compat/explicit_bzero_win32.c
21		../openbsd-compat/getopt_long.c
22		../openbsd-compat/readpassphrase_win32.c
23	)
24	if (BUILD_SHARED_LIBS)
25		list(APPEND COMPAT_SOURCES ../openbsd-compat/posix_win.c)
26	endif()
27else()
28	list(APPEND COMPAT_SOURCES ../openbsd-compat/readpassphrase.c)
29endif()
30
31if(NOT MSVC)
32	set_source_files_properties(assert_get.c assert_verify.c base64.c bio.c
33	    config.c cred_make.c cred_verify.c credman.c fido2-assert.c
34	    fido2-cred.c fido2-token.c pin.c token.c util.c
35	    PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
36endif()
37
38add_executable(fido2-cred
39	fido2-cred.c
40	cred_make.c
41	cred_verify.c
42	base64.c
43	util.c
44	${COMPAT_SOURCES}
45)
46
47add_executable(fido2-assert
48	fido2-assert.c
49	assert_get.c
50	assert_verify.c
51	base64.c
52	util.c
53	${COMPAT_SOURCES}
54)
55
56add_executable(fido2-token
57	fido2-token.c
58	base64.c
59	bio.c
60	config.c
61	credman.c
62	largeblob.c
63	pin.c
64	token.c
65	util.c
66	${COMPAT_SOURCES}
67)
68
69target_link_libraries(fido2-cred ${CRYPTO_LIBRARIES} ${_FIDO2_LIBRARY})
70target_link_libraries(fido2-assert ${CRYPTO_LIBRARIES} ${_FIDO2_LIBRARY})
71target_link_libraries(fido2-token ${CRYPTO_LIBRARIES} ${_FIDO2_LIBRARY})
72
73install(TARGETS fido2-cred fido2-assert fido2-token
74	DESTINATION ${CMAKE_INSTALL_BINDIR})
75