mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-20 19:02:04 +00:00
add a macro to simplify adding unit tests
This commit is contained in:
parent
2fbcd84238
commit
42a6a2153a
3 changed files with 14 additions and 4 deletions
|
@ -508,7 +508,6 @@ configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake
|
|||
add_subdirectory ( src )
|
||||
add_subdirectory ( doc )
|
||||
|
||||
ENABLE_TESTING()
|
||||
add_subdirectory ( test )
|
||||
|
||||
# pkg-config support
|
||||
|
|
9
cmake_admin/FluidUnitTest.cmake
Normal file
9
cmake_admin/FluidUnitTest.cmake
Normal file
|
@ -0,0 +1,9 @@
|
|||
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 $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
||||
|
||||
ADD_TEST(NAME ${_test} COMMAND ${_test})
|
||||
endmacro ( ADD_FLUID_TEST )
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
project(fluidsynth-test)
|
||||
|
||||
ENABLE_TESTING()
|
||||
include ( FluidUnitTest )
|
||||
|
||||
|
||||
ADD_FLUID_TEST(test_sfont_cache)
|
||||
|
||||
ADD_EXECUTABLE(test_sfont_cache test_sfont_cache.cpp)
|
||||
TARGET_LINK_LIBRARIES(test_sfont_cache libfluidsynth)
|
||||
ADD_TEST(NAME test_sfont_cache COMMAND test_sfont_cache)
|
||||
|
||||
# make test only runs tests, but doesnt build them
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS test_sfont_cache)
|
||||
|
|
Loading…
Reference in a new issue