commit 3c511a617b7c5a4109d7a679822c49fcf5b1ab3a
parent 12dbae4afdfc9e30f22446e5cf3d20f706ee67fb
Author: Frederic Cambus <fred@statdns.com>
Date: Thu, 14 Jan 2016 10:18:24 +0100
Modifying CMakeList to link pledge conditionally
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -5,7 +5,7 @@
# http://www.logswan.org #
# #
# Created: 2015-05-31 #
-# Last Updated: 2016-01-10 #
+# Last Updated: 2016-01-14 #
# #
# Logswan is released under the BSD 3-Clause license. #
# See LICENSE file for details. #
@@ -19,10 +19,10 @@ project(logswan C)
include(CheckFunctionExists)
include(GNUInstallDirs)
-# Check if system has strtonum and pledge
+# Check if system has pledge and strtonum
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE)
-check_function_exists(strtonum HAVE_STRTONUM)
check_function_exists(pledge HAVE_PLEDGE)
+check_function_exists(strtonum HAVE_STRTONUM)
# Additional include directories for compat functions + dependencies
include_directories("compat")
@@ -42,6 +42,10 @@ set(CMAKE_BUILD_TYPE Release)
set(DEPS deps/hll/hll.c deps/MurmurHash3/MurmurHash3.c)
set(SRC src/logswan.c src/config.c src/output.c src/parse.c)
+if(NOT HAVE_PLEDGE)
+ set (SRC ${SRC} compat/pledge.c)
+endif()
+
if(NOT HAVE_STRTONUM)
set (SRC ${SRC} compat/strtonum.c)
endif()