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