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
This commit is contained in:
Brad Larsen 2024-03-06 16:32:12 -05:00
parent 71f3e7d994
commit bd7423f4f0

View File

@ -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()
option(BUILD_DOC "Build the Hyperscan documentation (default TRUE)" TRUE)
if(BUILD_DOC)
add_subdirectory(doc/dev-reference)
endif()