From 421d6f9dd66d7da81cf3cf3cf27e814e718d567f Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 10 Apr 2026 10:06:07 +0200 Subject: [PATCH] CMake: add an option to enable/disable tests --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fb6649..80bc485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ project(spatialaudio VERSION ${MESON_RELEASE_VERSION_MAJOR}.${MESON_RELEASE_VERS # Options option(BUILD_SHARED_LIBS "Build shared instead of static libraries" ON) option(HAVE_MIT_HRTF "Should MIT HRTF be built-in" ON) +option(BUILD_TESTING "Build tests" OFF) include(GNUInstallDirs) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") @@ -201,8 +202,10 @@ install(TARGETS spatialaudio install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -enable_testing() -add_subdirectory(tests) +if(BUILD_TESTING) + enable_testing() + add_subdirectory(tests) +endif(BUILD_TESTING) # Tarballs generation set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})