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