From bd7423f4f0a02c226951760268b131043d93ee95 Mon Sep 17 00:00:00 2001 From: Brad Larsen Date: Wed, 6 Mar 2024 16:32:12 -0500 Subject: [PATCH] Add CMake options for more build granularity This adds three new CMake options, all defaulting to true, making it possible to opt-out of building parts of Vectorscan that are not essential for deployment of the matching runtime. These new options: - `BUILD_UNIT`: control whether the `unit` directory is included - `BUILD_DOC`: control whether the `doc` directory is included - `BUILD_TOOLS`: control whether the `tools` directory is included --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7e07a9a..c6952f41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1221,11 +1221,17 @@ if (NOT BUILD_STATIC_LIBS) endif () add_subdirectory(util) -add_subdirectory(unit) -if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) +option(BUILD_UNIT "Build Hyperscan unit tests (default TRUE)" TRUE) +if(BUILD_UNIT) + add_subdirectory(unit) +endif() + +option(BUILD_TOOLS "Build Hyperscan tools (default TRUE)" TRUE) +if(EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt AND BUILD_TOOLS) add_subdirectory(tools) endif() + if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) add_subdirectory(chimera) endif() @@ -1240,4 +1246,7 @@ if(BUILD_BENCHMARKS) add_subdirectory(benchmarks) endif() -add_subdirectory(doc/dev-reference) +option(BUILD_DOC "Build the Hyperscan documentation (default TRUE)" TRUE) +if(BUILD_DOC) + add_subdirectory(doc/dev-reference) +endif()