diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cc0e7d9..25545894 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,9 @@ if(COVERAGE) add_link_options(-fprofile-instr-generate) endif() -enable_testing() +option(BUILD_BENCHMARKS "Build benchmark targets" ON) + +include(CTest) include(GoogleTest) include_directories(include) diff --git a/src/fibers/CMakeLists.txt b/src/fibers/CMakeLists.txt index 16122646..6a07178b 100644 --- a/src/fibers/CMakeLists.txt +++ b/src/fibers/CMakeLists.txt @@ -4,5 +4,9 @@ add_library(silk-fibers ${FIBERS_SOURCES}) target_link_libraries(silk-fibers PUBLIC silk-util) target_link_libraries(silk-fibers PRIVATE Fcontext::Fcontext Liburing::Liburing) -add_subdirectory(tests) -add_subdirectory(benchmarks) +if(BUILD_TESTING) + add_subdirectory(tests) +endif() +if(BUILD_BENCHMARKS) + add_subdirectory(benchmarks) +endif() diff --git a/src/gdb/CMakeLists.txt b/src/gdb/CMakeLists.txt index 88c05163..01f2383d 100644 --- a/src/gdb/CMakeLists.txt +++ b/src/gdb/CMakeLists.txt @@ -1 +1,3 @@ -add_subdirectory(tests) +if(BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/src/profiler/CMakeLists.txt b/src/profiler/CMakeLists.txt index deb450c8..9bb9034d 100644 --- a/src/profiler/CMakeLists.txt +++ b/src/profiler/CMakeLists.txt @@ -96,4 +96,6 @@ add_dependencies(profiler profiler-skel) target_include_directories(profiler PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(profiler PRIVATE Libbpf::Libbpf symbolizer cxxopts::cxxopts) -add_subdirectory(tests) +if(BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index f0f43c3b..55643619 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -11,5 +11,9 @@ if(BUILD_LIBBACKTRACE) target_link_libraries(silk-util PRIVATE Libbacktrace::Libbacktrace) endif() -add_subdirectory(tests) -add_subdirectory(benchmarks) +if(BUILD_TESTING) + add_subdirectory(tests) +endif() +if(BUILD_BENCHMARKS) + add_subdirectory(benchmarks) +endif()