
add_library(bongoutil SHARED
    pools.c
    memstack.c
	array.c
	fileio.c
	hashtable.c
	bongothreadpool.c
	bongokeyword.c
	lists.c
	stringbuilder.c
	quicksort.c
	utf7mod.c
	logging.c
	maildrop.c
	domain.c
	bongoutil.c)

target_link_libraries(bongoutil PRIVATE
	bongoxpl
	GLib2::GLib2
	LibIDN2::LibIDN2
	Threads::Threads
)

install(TARGETS bongoutil DESTINATION ${LIB_INSTALL_DIR})

if(BUILD_TESTING)
	add_executable(util-config-integer-test
		tests/config-integer-test.c config-integer.c)
	target_compile_definitions(util-config-integer-test PRIVATE _NO_BONGO_GLOBALS)
	add_test(NAME util-config-integer COMMAND util-config-integer-test)

	add_executable(util-array-test tests/array-test.c array.c)
	target_link_libraries(util-array-test PRIVATE GLib2::GLib2)
	add_test(NAME util-array COMMAND util-array-test)

	add_executable(util-domain-test tests/domain-test.c domain.c)
	target_link_libraries(util-domain-test PRIVATE LibIDN2::LibIDN2)
	add_test(NAME util-domain COMMAND util-domain-test)

	add_executable(util-maildrop-test tests/maildrop-test.c maildrop.c)
	target_link_libraries(util-maildrop-test PRIVATE GLib2::GLib2)
	add_test(NAME util-maildrop COMMAND util-maildrop-test)
endif()
