commit bde17526e79d9dd71a1d67ed3d9e680fd2c62350 parent 5b703a27eb173610ac99cfd972e201fd0d57831b Author: Frederic Cambus <fred@statdns.com> Date: Thu, 14 Nov 2019 14:33:23 +0100 Add ENABLE_SECCOMP build option, to allow building seccomp support conditionally. Diffstat:
M | CMakeLists.txt | | | 26 | ++++++++++++++++---------- |
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -4,7 +4,7 @@ # https://www.logswan.org # # Created: 2015-05-31 -# Last Updated: 2018-10-26 +# Last Updated: 2018-11-14 # # Logswan is released under the BSD 2-Clause license # See LICENSE file for details @@ -17,20 +17,26 @@ project(logswan C) include(CheckFunctionExists) include(GNUInstallDirs) +# Conditional build options +set(ENABLE_SECCOMP 1 + CACHE BOOL "Enable building with seccomp") + # Check if system has pledge and strtonum list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE) check_function_exists(pledge HAVE_PLEDGE) check_function_exists(strtonum HAVE_STRTONUM) -# Check if system has seccomp -message(STATUS "Looking for seccomp") -find_path(SECCOMP NAMES "linux/seccomp.h") -if(SECCOMP) - message(STATUS "Looking for seccomp - found") - add_definitions(-DHAVE_SECCOMP=1) -else() - message(STATUS "Looking for seccomp - not found") -endif() +if(ENABLE_SECCOMP) + # Check if system has seccomp + message(STATUS "Looking for seccomp") + find_path(SECCOMP NAMES "linux/seccomp.h") + if(SECCOMP) + message(STATUS "Looking for seccomp - found") + add_definitions(-DHAVE_SECCOMP=1) + else() + message(STATUS "Looking for seccomp - not found") + endif() +endif(ENABLE_SECCOMP) # Additional include directories for compat functions + dependencies include_directories("compat")