From 57f3a14d590452abd56d55f39b7afe985cf40da3 Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Tue, 13 Aug 2019 15:13:09 +0200 Subject: [PATCH] make tests and examples optional --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d538b50..51abe39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.7.2) project(ghcfilesystem) +option(BUILD_TESTING "Enable tests" ON) +option(BUILD_EXAMPLES "Build examples" ON) + if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -28,9 +31,15 @@ if(NOT hasParent) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") include(GhcHelper) - enable_testing() - add_subdirectory(test) - add_subdirectory(examples) + + if(BUILD_TESTING) + enable_testing() + add_subdirectory(test) + endif() + + if(BUILD_EXAMPLES) + add_subdirectory(examples) + endif() endif() include(CMakePackageConfigHelpers)