commit 9cc58383171e2f5bb636db468a787484d2243af5
parent ccc00c387cfb6779437ccf26fb05b3d486e7dfc5
Author: Frederic Cambus <fred@statdns.com>
Date: Wed, 20 Jan 2016 16:55:55 +0100
Modifying CMakeList to link pledge conditionally
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -5,8 +5,9 @@ project (ansilove C)
include(CheckFunctionExists)
include(GNUInstallDirs)
-# Check if system has strtonum
+# 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)
# Additional include directories for compat functions
@@ -21,6 +22,10 @@ set(SRC src/main.c src/albinfonts.c src/ansilove.c src/explode.c src/filesize.c
set(FORMATS src/ansi.c src/artworx.c src/binary.c src/icedraw.c src/pcboard.c src/tundra.c src/xbin.c)
+if(NOT HAVE_PLEDGE)
+ set (SRC ${SRC} compat/pledge.c)
+endif()
+
if(NOT HAVE_STRTONUM)
set (SRC ${SRC} compat/strtonum.c)
endif()