xref: /freebsd/contrib/libder/tests/CMakeLists.txt (revision 35c0a8c449fd2b7f75029ebed5e10852240f0865)
1*35c0a8c4SKyle Evansset(FUZZERS fuzz_parallel fuzz_stream fuzz_write)
2*35c0a8c4SKyle Evansset(UTILS )
3*35c0a8c4SKyle Evansset(TESTS test_privkey test_pubkey)
4*35c0a8c4SKyle Evans
5*35c0a8c4SKyle Evansset(ALL_TESTS ${UTILS} ${TESTS})
6*35c0a8c4SKyle Evans
7*35c0a8c4SKyle Evansif(BUILD_FUZZERS)
8*35c0a8c4SKyle Evans	set(UTILS ${UTILS} make_corpus)
9*35c0a8c4SKyle Evans	set(ALL_TESTS ${ALL_TESTS} ${FUZZERS} make_corpus)
10*35c0a8c4SKyle Evans
11*35c0a8c4SKyle Evans	foreach(fuzzer IN LISTS FUZZERS)
12*35c0a8c4SKyle Evans		add_executable(${fuzzer} ${fuzzer}.c)
13*35c0a8c4SKyle Evans
14*35c0a8c4SKyle Evans		target_compile_options(${fuzzer} PUBLIC -fsanitize=fuzzer)
15*35c0a8c4SKyle Evans		target_link_options(${fuzzer} PUBLIC -fsanitize=fuzzer)
16*35c0a8c4SKyle Evans	endforeach()
17*35c0a8c4SKyle Evans
18*35c0a8c4SKyle Evans	target_link_options(fuzz_parallel PUBLIC -pthread)
19*35c0a8c4SKyle Evansendif()
20*35c0a8c4SKyle Evans
21*35c0a8c4SKyle Evansforeach(prog IN LISTS UTILS TESTS)
22*35c0a8c4SKyle Evans	add_executable(${prog} ${prog}.c)
23*35c0a8c4SKyle Evansendforeach()
24*35c0a8c4SKyle Evans
25*35c0a8c4SKyle Evansforeach(prog IN LISTS ALL_TESTS)
26*35c0a8c4SKyle Evans	target_include_directories(${prog} PRIVATE ${CMAKE_SOURCE_DIR}/libder)
27*35c0a8c4SKyle Evans	target_link_libraries(${prog} der_static)
28*35c0a8c4SKyle Evansendforeach()
29*35c0a8c4SKyle Evans
30*35c0a8c4SKyle Evansadd_custom_command(TARGET test_privkey POST_BUILD
31*35c0a8c4SKyle Evans	COMMAND ${CMAKE_COMMAND} -E copy
32*35c0a8c4SKyle Evans	${CMAKE_CURRENT_SOURCE_DIR}/repo.priv ${CMAKE_CURRENT_BINARY_DIR}/repo.priv)
33*35c0a8c4SKyle Evansadd_custom_command(TARGET test_pubkey POST_BUILD
34*35c0a8c4SKyle Evans	COMMAND ${CMAKE_COMMAND} -E copy
35*35c0a8c4SKyle Evans	${CMAKE_CURRENT_SOURCE_DIR}/repo.pub ${CMAKE_CURRENT_BINARY_DIR}/repo.pub)
36*35c0a8c4SKyle Evans
37*35c0a8c4SKyle Evansadd_custom_target(check
38*35c0a8c4SKyle Evans	DEPENDS test_pubkey test_privkey
39*35c0a8c4SKyle Evans	COMMAND "${CMAKE_CURRENT_BINARY_DIR}/test_pubkey"
40*35c0a8c4SKyle Evans	COMMAND "${CMAKE_CURRENT_BINARY_DIR}/test_privkey"
41*35c0a8c4SKyle Evans)
42