BastionGuard/webui/deploy/cmake/BastionGuard-WebUI-install-snippet.cmake
specialworld83 f0f913a209 Release 2.0
2026-07-15 10:52:22 +02:00

47 lines
1.9 KiB
CMake

# ============================================================
# BastionGuard WebUI
# ============================================================
# The WebUI lives in the repository root under ./webui.
# It is always staged into the build tree and installed with the main project.
# No -DINSTALL_BASTIONGUARD_WEBUI=ON flag is required.
set(BG_WEBUI_SOURCE_DIR "${CMAKE_SOURCE_DIR}/webui")
set(BG_WEBUI_BUILD_DIR "${CMAKE_BINARY_DIR}/webui")
if(EXISTS "${BG_WEBUI_SOURCE_DIR}/index.php")
add_custom_target(BastionGuard-webui ALL
COMMAND ${CMAKE_COMMAND} -E rm -rf "${BG_WEBUI_BUILD_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${BG_WEBUI_SOURCE_DIR}"
"${BG_WEBUI_BUILD_DIR}"
COMMENT "Staging BastionGuard WebUI into the build directory"
VERBATIM
)
install(DIRECTORY "${BG_WEBUI_BUILD_DIR}/"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/BastionGuard/webui"
USE_SOURCE_PERMISSIONS
COMPONENT webui
PATTERN ".git" EXCLUDE
PATTERN "*.bak" EXCLUDE
PATTERN "*.tmp" EXCLUDE
)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/data/vhosts/webui/"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/BastionGuard/data/vhosts/webui"
USE_SOURCE_PERMISSIONS
COMPONENT webui
OPTIONAL
)
install(CODE "
message(STATUS \"[WebUI] Installed in: ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/BastionGuard/webui\")
file(MAKE_DIRECTORY /var/lib/bastionguard-webui)
file(MAKE_DIRECTORY /var/lib/bastionguard-webui/cache)
file(MAKE_DIRECTORY /var/lib/bastionguard-webui/quarantine)
file(MAKE_DIRECTORY /var/lib/bastionguard-webui/sessions)
file(MAKE_DIRECTORY /var/lib/bastionguard-webui/tmp)
file(MAKE_DIRECTORY /var/log/bastionguard-webui)
")
else()
message(WARNING "BastionGuard WebUI source not found at ${BG_WEBUI_SOURCE_DIR}; WebUI will not be installed.")
endif()