#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem=cmake --builddirectory=build

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
		-DCMAKE_SKIP_RPATH=ON \
		-DBUILD_PYTHON_BINDINGS=OFF \
		-DRUN_DOXYGEN=OFF \
		-DOPTIMIZE=OFF

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# The upstream test harness is a standalone binary, not integrated with
	# CTest.  It needs the build-tree library because Debian builds with
	# CMAKE_SKIP_RPATH=ON.
	cd build && LD_LIBRARY_PATH=$(CURDIR)/build/lib ./bin/test_libbdsg
endif
