Skip to content

Commit 57f3a14

Browse files
make tests and examples optional
1 parent e980ed0 commit 57f3a14

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

CMakeLists.txt

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
cmake_minimum_required(VERSION 3.7.2)
22
project(ghcfilesystem)
33

4+
option(BUILD_TESTING "Enable tests" ON)
5+
option(BUILD_EXAMPLES "Build examples" ON)
6+
47
if(NOT DEFINED CMAKE_CXX_STANDARD)
58
set(CMAKE_CXX_STANDARD 11)
69
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -28,9 +31,15 @@ if(NOT hasParent)
2831
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
2932
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
3033
include(GhcHelper)
31-
enable_testing()
32-
add_subdirectory(test)
33-
add_subdirectory(examples)
34+
35+
if(BUILD_TESTING)
36+
enable_testing()
37+
add_subdirectory(test)
38+
endif()
39+
40+
if(BUILD_EXAMPLES)
41+
add_subdirectory(examples)
42+
endif()
3443
endif()
3544

3645
include(CMakePackageConfigHelpers)

0 commit comments

Comments
 (0)