From 21890527220cc92fa4e624a0f537d709a1a8c637 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 3 Nov 2021 23:09:54 +0000 Subject: [PATCH] Disable building of the examples `libzt` adds build target for its examples by default. However, the `examples/` directory is marked as `export-ignore` in libzt's `.gitattributes`, so it does not get included into the GitHub-provided archive. While we use a recursive git fetch (and are not affected), distributions may override this with `-DFETCHCONTENT_SOURCE_DIR_LIBZT=...`, where `export-ignore` files may be omitted from the source directory. --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d357feb..0c64c51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,13 +33,12 @@ endif () if (BUILDING_WIN32 OR BUILDING_WIN64 OR MSVC) set (BUILDING_WIN TRUE) endif () -if (NOT BUILDING_ANDROID AND NOT IN_XCODE) - set(SHOULD_BUILD_TESTS TRUE) -endif () if (BUILDING_WIN32 OR BUILDING_WIN64 OR MSVC) set (BUILDING_WIN TRUE) endif () +option(BUILD_EXAMPLES "Build the examples" OFF) + # ----------------------------------------------------------------------------- # | BUILD TYPES | # ----------------------------------------------------------------------------- @@ -451,7 +450,7 @@ endif () # | EXECUTABLES | # ----------------------------------------------------------------------------- -if (SHOULD_BUILD_TESTS) +if (BUILD_EXAMPLES) add_executable (earthtest ${PROJ_DIR}/examples/cpp/earthtest.cpp) target_link_libraries(earthtest ${STATIC_LIB_NAME}) add_executable (adhoc ${PROJ_DIR}/examples/cpp/adhoc.cpp)