Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ include(${BUILD_CMAKE_FOLDER}/GoogleProtoBuf.cmake)
# functions.cmake so NSCP_CREATE_TEST can honour it.
option(NSCP_BUILD_TESTS "Build the unit tests (requires Google Test)" ON)

# WEBServer's per-module flag (the generic BUILD_MODULE_<name> option that
# LOAD_SECTIONS declares for every module) is consumed *early* here — by the
# HTTP backend selector in dependencies.cmake and by the libs/* glob that adds
# its Beast/mongoose backend library (libs/mongoose-cpp -> nscp_mongoose) — long
# before LOAD_SECTIONS would normally declare it. Declare it up front so those
# early consumers see it (and its ON default); LOAD_SECTIONS' later option()
# call for it is then a no-op. With -DBUILD_MODULE_WEBServer=OFF this turns off
# the module, its HTTP backend library, the backend selector and the mongoose
# wrapper test together — a build with no web/HTTP server at all (e.g. a
# stripped-down agent package).
option(BUILD_MODULE_WEBServer "Build module WEBServer" ON)

include(${BUILD_CMAKE_FOLDER}/functions.cmake)

# ##############################################################################
Expand Down Expand Up @@ -1020,6 +1032,8 @@ foreach(CURRENT_LIB ${ALL_LIB_PROJECTS})
OR CURRENT_LIB_NAME
STREQUAL
"dotnet-plugin-api"
OR (NOT BUILD_MODULE_WEBServer
AND CURRENT_LIB_NAME STREQUAL "mongoose-cpp")
)
message(
STATUS
Expand Down
7 changes: 7 additions & 0 deletions build/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ set(NSCP_ZIP_BACKEND
# variable of the same name — silently reverting build.cmake's
# `SET(NSCP_WEB_BACKEND "beast")` back to mongoose. That broke the Linux
# (beast) package builds, which opt in via build.cmake rather than -D.
#
# The HTTP backend only matters when the WEBServer module is built; skip the
# whole selector otherwise so a no-web build (-DBUILD_MODULE_WEBServer=OFF)
# needs no backend at all — neither the vendored mongoose source nor
# Beast/OpenSSL — and does not abort here.
if(BUILD_MODULE_WEBServer)
if(NOT DEFINED NSCP_WEB_BACKEND)
set(NSCP_WEB_BACKEND "mongoose")
endif()
Expand Down Expand Up @@ -121,6 +127,7 @@ elseif(NSCP_WEB_BACKEND STREQUAL "beast")
else()
message(FATAL_ERROR "Unknown NSCP_WEB_BACKEND='${NSCP_WEB_BACKEND}' (expected mongoose | beast)")
endif()
endif() # BUILD_MODULE_WEBServer (HTTP backend selector)
# CMP0167 (CMake 3.30+) removes the bundled FindBoost module in favour of
# upstream BoostConfig.
if(POLICY CMP0167)
Expand Down
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ NSCP_CREATE_TEST(
${CMAKE_SOURCE_DIR}/modules/IcingaClient
)

# The mongoose wrapper test links nscp_mongoose, which only exists when the
# WEBServer module / HTTP backend is built. Skip it otherwise so the missing
# target does not break configuration.
if(BUILD_MODULE_WEBServer)
set(MONGOOSE_CPP_DIR ${CMAKE_SOURCE_DIR}/libs/mongoose-cpp)

# Shared (backend-independent) test sources.
Expand Down Expand Up @@ -565,6 +569,7 @@ if(WIN32)
COMMAND_EXPAND_LISTS
)
endif()
endif() # BUILD_MODULE_WEBServer (mongoose_wrapper_test)

set(SETTINGS_INI_TEST_SOURCES
${NSCP_INCLUDEDIR}/settings/impl/settings_ini_test.cpp
Expand Down