StrictCompile()

enable_language(ASM-ATT)

add_executable(bongostore
	accounts.c
	auth.c
	calendar.c
	sql/createstore.s
	sql/createcookie-1.s
	command.c
	command-parsing.c
	contacts.c
	config.c
	cookie.c
	db.c
	fairlock.c
	guid.c
	locking.c
	mail.c
	maildir.c
	main.c
	mime.c
	object-model.c
	object-queries.c
	properties.c
	query-builder.c
	query-parser.c
	ringlog.c
	search.c
	store.c
	stored.c
	watch.c)

target_link_libraries(bongostore
	bongostreamio
	bongoxpl
	bongoconnio
	bongoutil
	bongojson
	bongomsgapi
	SQLite3::SQLite3
	GLib2::GLib2
	LibIcal::ical
	GMime::GMime
	)

install(TARGETS bongostore DESTINATION ${SBIN_INSTALL_DIR})

if(BUILD_TESTING)
	add_executable(store-logical-lock-test
		tests/logical-lock-test.c
		locking.c)
	target_link_libraries(store-logical-lock-test PRIVATE
		bongoxpl
		GLib2::GLib2
		Threads::Threads)
	add_test(NAME store-logical-lock COMMAND store-logical-lock-test)
	set_tests_properties(store-logical-lock PROPERTIES TIMEOUT 10)
endif()
