From f74e38a572e4c616fad12f433262181f5105f71f Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Mon, 27 Nov 2023 22:00:01 -0500 Subject: [PATCH] feat(build): add cache var to disable examples Add `OBX_DISABLE_EXAMPLES` with a default value of `OFF` to control including the examples directory in the default build. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0c6841..6a7b5eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0) project(ObjectBoxCRoot) # to be displayed in an IDE when this CMake is opened +set(OBX_DISABLE_EXAMPLES OFF CACHE BOOL "Enable/disable including the ObjectBox examples") + if (${CMAKE_VERSION} VERSION_LESS "3.11.0") message("Please consider upgrading your CMake to a more recent version (v3.11+) to get automatic library download.") if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib") @@ -78,4 +80,7 @@ endif () add_subdirectory(src-test) add_subdirectory(src-test-gen) -add_subdirectory(examples) + +if (NOT DEFINED OBX_DISABLE_EXAMPLES OR NOT ${OBX_DISABLE_EXAMPLES}) + add_subdirectory(examples) +endif ()