aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-11-09 13:41:02 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-11-09 13:41:02 +0000
commit8a1d65bbb676629035c2688187e780e3299e6824 (patch)
tree0d3263f39809ca3a8f55752a748400b156300e98
parent6cca898932e253ec26d1022178b7394348286121 (diff)
downloadrspamd-8a1d65bbb676629035c2688187e780e3299e6824.tar.gz
rspamd-8a1d65bbb676629035c2688187e780e3299e6824.zip
[Conf] Allow to install examples conditionally
-rw-r--r--CMakeLists.txt12
1 files changed, 8 insertions, 4 deletions
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})")