aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-07-13 13:29:36 +0100
committerKatharina Fey <kookie@spacekookie.de>2019-07-13 13:30:49 +0100
commit42cd7d8cd86c39af525f28c8c6c28f1a342c697b (patch)
treef34c3930c8e12c54809fb053cf1886474ff22ff2
parent9130e47b171c5182ffe6c14eb710fdcb73943de4 (diff)
Conditionally compiling example binaries
-rw-r--r--CMakeLists.txt12
1 files changed, 8 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index abe82d3..4097a78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c11")
set(CMAKE_BUILD_TYPE Debug)
+set(BUILD_EXAMPLES 0 CACHE BOOL "Build the included examples projects")
project(bowl)
add_library(bowl SHARED array.c
@@ -12,8 +13,11 @@ add_library(bowl SHARED array.c
target_include_directories(bowl PUBLIC ".")
################### EXAMPLES ###################
-add_executable(ex_tree examples/tree.c)
-target_link_libraries(ex_tree bowl)
-add_executable(ex_list examples/list.c)
-target_link_libraries(ex_list bowl)
+if(BUILD_EXAMPLES)
+ add_executable(ex_tree examples/tree.c)
+ target_link_libraries(ex_tree bowl)
+
+ add_executable(ex_list examples/list.c)
+ target_link_libraries(ex_list bowl)
+endif()