From 42cd7d8cd86c39af525f28c8c6c28f1a342c697b Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sat, 13 Jul 2019 13:29:36 +0100 Subject: Conditionally compiling example binaries --- CMakeLists.txt | 12 ++++++++---- 1 file 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() -- cgit v1.2.3