From dc5305dbdd39d5f90c0413704d6945c5f8ac6617 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Thu, 29 Sep 2022 06:32:21 +0200 Subject: [PATCH 2/2] Add an option to enable/disable building examples --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f42869..3f6de05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ project(zlib C) set(VERSION "1.2.13") +option(BUILD_EXAMPLES "Build examples" ON) + set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") @@ -194,6 +196,7 @@ endif() # Example binaries #============================================================================ +if(BUILD_EXAMPLES) add_executable(example test/example.c) target_link_libraries(example zlib) add_test(example example) @@ -211,3 +214,4 @@ if(HAVE_OFF64_T) target_link_libraries(minigzip64 zlib) set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") endif() +endif(BUILD_EXAMPLES) -- 2.37.3.windows.1