cmake: allow disabling the web layer via BUILD_MODULE_WEBServer#1307
Closed
Fantu wants to merge 1 commit into
Closed
cmake: allow disabling the web layer via BUILD_MODULE_WEBServer#1307Fantu wants to merge 1 commit into
Fantu wants to merge 1 commit into
Conversation
Upstream always builds the Beast/mongoose HTTP backend library: libs/mongoose-cpp (nscp_mongoose) is added by the unconditional libs/* glob and installed by NSCP_MAKE_LIBRARY, the HTTP backend selector in dependencies.cmake runs and aborts when its mongoose default cannot find the Windows-only vendored source, and the mongoose wrapper test links nscp_mongoose. Disabling only the WEBServer module via the generic per-module flag (-DBUILD_MODULE_WEBServer=OFF) therefore still builds and installs that library orphaned, still runs the backend selector and still requires a backend. Rather than add a new top-level option, reuse the existing per-module flag that LOAD_SECTIONS already declares for every module, so a single -DBUILD_MODULE_WEBServer=OFF turns off the whole web layer in one place (same flag name and spelling as every other module): - CMakeLists.txt: declare option(BUILD_MODULE_WEBServer ...) up front, before dependencies.cmake and the libs/* glob, so those early consumers see it (and its ON default). LOAD_SECTIONS' later option() call for the same name is then a no-op, and it keeps honouring the flag natively to skip the module itself - so modules/WEBServer/module.cmake needs no change. - CMakeLists.txt: skip libs/mongoose-cpp in the libs glob when it is OFF. - build/cmake/dependencies.cmake: run the HTTP backend selector only when it is ON, so a no-web build needs neither the vendored mongoose source nor Beast/OpenSSL and does not abort. - tests/CMakeLists.txt: gate the mongoose wrapper test, which links nscp_mongoose (no longer built). With BUILD_MODULE_WEBServer=ON (the default) nothing changes: configure on Debian sid still selects the backend (e.g. beast) and adds the mongoose library as before. With -DBUILD_MODULE_WEBServer=OFF the backend selector is skipped, no mongoose backend library is built, and the WEBServer module is reported as disabled - a build with no web/HTTP server at all (e.g. a stripped-down agent package). Assisted-by: Claude Code (Opus 4.8) Signed-off-by: Fabio Fantoni <fantonifabio@tiscali.it>
Owner
|
I have been pondering this and I think the problem here is that we bring in "all libraries" as dependencies (instead of using the actual dependencies). So if we remove that this would likely "sort it self out"... |
Owner
|
Here is how that looks: https://github.com/mickem/nscp/pull/1308/changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream always builds the Beast/mongoose HTTP backend library: libs/mongoose-cpp (nscp_mongoose) is added by the unconditional libs/* glob and installed by NSCP_MAKE_LIBRARY, the HTTP backend selector in dependencies.cmake runs and aborts when its mongoose default cannot find the Windows-only vendored source, and the mongoose wrapper test links nscp_mongoose. Disabling only the WEBServer module via the generic per-module flag (-DBUILD_MODULE_WEBServer=OFF) therefore still builds and
installs that library orphaned, still runs the backend selector and still
requires a backend.
Rather than add a new top-level option, reuse the existing per-module flag that LOAD_SECTIONS already declares for every module, so a single -DBUILD_MODULE_WEBServer=OFF turns off the whole web layer in one place (same flag name and spelling as every other module):
see it (and its ON default). LOAD_SECTIONS' later option() call for the
same name is then a no-op, and it keeps honouring the flag natively to
skip the module itself - so modules/WEBServer/module.cmake needs no
change.
it is ON, so a no-web build needs neither the vendored mongoose source nor Beast/OpenSSL and does not abort.
With BUILD_MODULE_WEBServer=ON (the default) nothing changes: configure on Debian sid still selects the backend (e.g. beast) and adds the mongoose library as before. With -DBUILD_MODULE_WEBServer=OFF the backend
selector is skipped, no mongoose backend library is built, and the WEBServer module is reported as disabled - a build with no web/HTTP server at all (e.g. a stripped-down agent package).
Assisted-by: Claude Code (Opus 4.8)