From 11746b49c3f2af5b813de26954a39be5f6e70f49 Mon Sep 17 00:00:00 2001 From: Moritz <mohe2015@users.noreply.github.com> Date: Wed, 3 Oct 2018 23:32:19 +0200 Subject: [PATCH] Disable building tests when including as subproject (#79) --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eaac18..3b21678 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,8 +20,10 @@ add_library(${PROJECT_NAME} ${SRC}) target_include_directories(${PROJECT_NAME} INTERFACE src) # test -enable_testing() -add_subdirectory(test) -find_package(Sanitizers) -add_sanitizers(${PROJECT_NAME} test.exe) -add_sanitizers(${PROJECT_NAME} test_miniz.exe) +if (NOT CMAKE_DISABLE_TESTING) + enable_testing() + add_subdirectory(test) + find_package(Sanitizers) + add_sanitizers(${PROJECT_NAME} test.exe) + add_sanitizers(${PROJECT_NAME} test_miniz.exe) +endif()