macro ( ADD_FLUID_TEST _test ) ADD_EXECUTABLE(${_test} ${_test}.c) TARGET_LINK_LIBRARIES(${_test} libfluidsynth) # use the local include path to look for fluidsynth.h, as we cannot be sure fluidsynth is already installed target_include_directories(${_test} PUBLIC $ # include auto generated headers $ # include "normal" public (sub-)headers $ # include private headers $ # include all other header search paths needed by libfluidsynth (esp. glib) ) # add the test to ctest ADD_TEST(NAME ${_test} COMMAND ${_test}) # append the current unit test to check-target as dependency add_dependencies(check ${_test}) endmacro ( ADD_FLUID_TEST )