From: Vsevolod Stakhov Date: Sat, 9 Nov 2024 13:41:02 +0000 (+0000) Subject: [Conf] Allow to install examples conditionally X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a1d65bbb676629035c2688187e780e3299e6824;p=rspamd.git [Conf] Allow to install examples conditionally --- diff --git a/CMakeLists.txt b/CMakeLists.txt index fc14da0d8..0d07e940f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ OPTION(ENABLE_LUAJIT "Link with libluajit [default: ON]" ON) OPTION(ENABLE_URL_INCLUDE "Enable urls in ucl includes (requires libcurl or libfetch) [default: OFF]" OFF) OPTION(NO_SHARED "Build internal libs static [default: ON]" ON) OPTION(INSTALL_WEBUI "Install web interface [default: ON]" ON) +OPTION(INSTALL_EXAMPLES "Install examples of the configuration and Lua [default: ON]" ON) OPTION(WANT_SYSTEMD_UNITS "Install systemd unit files on Linux [default: OFF]" OFF) OPTION(ENABLE_SNOWBALL "Enable snowball stemmer [default: ON]" ON) OPTION(ENABLE_CLANG_PLUGIN "Enable clang static analysing plugin [default: OFF]" OFF) @@ -714,11 +715,14 @@ INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${RULESDIR})") LIST(LENGTH CONFFILES CONFLIST_COUNT) MATH(EXPR CONFLIST_MAX ${CONFLIST_COUNT}-1) +SET(GLOB_PATTERNS "${CMAKE_SOURCE_DIR}/conf/*.conf;${CMAKE_SOURCE_DIR}/conf/*.inc") +IF(INSTALL_EXAMPLES MATCHES "ON") + LIST(APPEND GLOB_PATTERNS "${CMAKE_SOURCE_DIR}/conf/*.lua.example") + LIST(APPEND GLOB_PATTERNS "${CMAKE_SOURCE_DIR}/conf/*.conf.example") +ENDIF() + FILE(GLOB_RECURSE CONF_FILES RELATIVE "${CMAKE_SOURCE_DIR}/conf" CONFIGURE_DEPENDS - "${CMAKE_SOURCE_DIR}/conf/*.conf" - "${CMAKE_SOURCE_DIR}/conf/*.inc" - "${CMAKE_SOURCE_DIR}/conf/*.lua.example" - "${CMAKE_SOURCE_DIR}/conf/*.conf.example") + ${GLOB_PATTERNS}) FOREACH (CONF_FILE ${CONF_FILES}) GET_FILENAME_COMPONENT(_rp ${CONF_FILE} PATH) INSTALL(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${CONFDIR}/${_rp})")