Skip to content

Commit 931bdf4

Browse files
authored
Merge pull request #2795 from aeolio/cmake-options
Introduce CMake options for optional dependencies
2 parents 08d9228 + 85c8997 commit 931bdf4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,12 @@ add_subdirectory(config)
348348
add_subdirectory(tools)
349349
add_subdirectory(ntp)
350350
351+
option(USE_READLINE "Build FTL with readline support, if available" ON)
352+
351353
find_library(LIBREADLINE NAMES libreadline${LIBRARY_SUFFIX} readline)
352354
find_library(LIBHISTORY NAMES libhistory${LIBRARY_SUFFIX} history)
353355
find_library(LIBTERMCAP NAMES libtermcap${LIBRARY_SUFFIX} termcap)
354-
if(LIBREADLINE AND LIBHISTORY AND LIBTERMCAP)
356+
if(LIBREADLINE AND LIBHISTORY AND LIBTERMCAP AND USE_READLINE)
355357
message(STATUS "Building FTL with readline support: YES")
356358
target_compile_definitions(lua PRIVATE LUA_USE_READLINE)
357359
target_compile_definitions(sqlite3 PRIVATE HAVE_READLINE)
@@ -364,19 +366,21 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
364366
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
365367
endif()
366368
369+
option(USE_MBED_TLS "Build FTL with TLS support, if available" ON)
370+
367371
find_library(LIBMBEDCRYPTO NAMES lmbedcrypto${LIBRARY_SUFFIX} mbedcrypto)
368372
find_library(LIBMBEDX509 NAMES lmbedx509${LIBRARY_SUFFIX} mbedx509)
369373
find_library(LIBMBEDTLS NAMES lmbedtls${LIBRARY_SUFFIX} mbedtls)
370-
if(LIBMBEDCRYPTO AND LIBMBEDX509 AND LIBMBEDTLS)
371-
# Enable TLS support in civetweb if mbedTLS is available
374+
if(LIBMBEDCRYPTO AND LIBMBEDX509 AND LIBMBEDTLS AND USE_MBED_TLS)
375+
# Enable TLS support in civetweb if mbedTLS is selected and available
372376
message(STATUS "Building FTL with TLS support: YES")
373377
target_compile_definitions(core PRIVATE HAVE_MBEDTLS)
374378
target_compile_definitions(civetweb PRIVATE USE_MBEDTLS)
375379
target_compile_definitions(webserver PRIVATE HAVE_MBEDTLS)
376380
# Link against the mbedTLS libraries, the order is important (!)
377381
target_link_libraries(pihole-FTL ${LIBMBEDTLS} ${LIBMBEDX509} ${LIBMBEDCRYPTO})
378382
else()
379-
# Disable TLS support in civetweb if mbedTLS is not available
383+
# Disable TLS support in civetweb if mbedTLS is not selected or not available
380384
message(STATUS "Building FTL with TLS support: NO")
381385
target_compile_definitions(civetweb PRIVATE NO_SSL)
382386
endif()

0 commit comments

Comments
 (0)