[cmake,channels] unset client/server options

If a channel is deactivated, delete the client and server options (e.g.
reset them to default) to avoid having something like
CHANNEL_NAME=OFF AND CHANNEL_NAME_CLIENT=ON
This commit is contained in:
Armin Novak
2025-08-18 11:11:48 +02:00
parent 4182472c31
commit b8fe92caeb

View File

@@ -46,6 +46,13 @@ macro(define_channel_options)
option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT})
endif()
# If the channel was enabled before the client/server options will stay ensure
# they are deleted if the channel is gone.
if(NOT ${CHANNEL_OPTION})
unset(${CHANNEL_CLIENT_OPTION} CACHE)
unset(${CHANNEL_SERVER_OPTION} CACHE)
endif()
cmake_dependent_option(
${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" ${CHANNEL_CLIENT_DEFAULT} "${CHANNEL_OPTION}" OFF
)