build: add option for building example binary

This commit is contained in:
Marcus Holland-Moritz 2024-08-14 12:21:11 +02:00
parent 845ab050bb
commit c68460ace7
2 changed files with 8 additions and 1 deletions

View File

@ -238,7 +238,7 @@ if [[ "$BUILD_FROM_TARBALL" == "1" ]]; then
esac
else
# shellcheck disable=SC2086
cmake ../dwarfs/ $CMAKE_ARGS
cmake ../dwarfs/ $CMAKE_ARGS -DWITH_EXAMPLE=1
time $BUILD_TOOL

View File

@ -38,6 +38,7 @@ option(TRY_ENABLE_FLAC "build with FLAC support" ON)
option(ENABLE_RICEPP "build with RICEPP compression support" ON)
option(WITH_UNIVERSAL_BINARY "build with universal binary" OFF)
option(WITH_PXATTR "build with pxattr binary" OFF)
option(WITH_EXAMPLE "build with example binary" OFF)
if(NOT (APPLE OR WIN32))
option(ENABLE_STACKTRACE "build with symbolizer support" ON)
endif()
@ -286,6 +287,12 @@ if(WITH_PXATTR)
list(APPEND BINARY_TARGETS pxattr)
endif()
if(WITH_EXAMPLE)
add_executable(example example/example.cpp)
target_link_libraries(example PRIVATE dwarfs_reader dwarfs_extractor)
list(APPEND BINARY_TARGETS example)
endif()
if(WITH_FUSE_DRIVER)
include(${CMAKE_SOURCE_DIR}/cmake/need_fuse.cmake)