From 5b00cc47f850c68def63ea2298ef1fdd26d5c124 Mon Sep 17 00:00:00 2001 From: Drew Rife Date: Sat, 12 Mar 2022 19:15:43 -0500 Subject: [PATCH] Build examples as an option (#30) * build: add option for enabling examples to be built * chore: formatting * docs: add generation for building examples * chore: formatting * on push * build: add option for enabling examples to be built * chore: formatting * docs: add generation for building examples * chore: formatting Co-authored-by: darife Co-authored-by: Erik Erlandson --- CMakeLists.txt | 5 ++++- README.md | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2712cc6..df1dda3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) project(st_tree VERSION 1.0.6) +option(BUILD_EXAMPLES "Build the examples." OFF) option(ENABLE_TESTS "Enable the tests. Requires boost." ON) include(GNUInstallDirs) @@ -15,7 +16,9 @@ ENDIF() add_subdirectory(include) # tutorial examples -add_subdirectory(examples) +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() # testing programs if(ENABLE_TESTS) diff --git a/README.md b/README.md index 68401bc..f1ff80c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ Quick start: $ cd /path/to/st_tree $ cmake . +# generate makefiles to build examples from cmake +$ cd /path/to/st_tree +$ cmake . -DBUILD_EXAMPLES=ON + # make examples and tests: $ make