From 0bf30ca72fff603bea651169ae816186b511a92c Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 20 Feb 2019 17:19:33 -0700 Subject: [PATCH] use _GNU_SOURCE instead of _POSIX_C_SOURCE CMakeLists.txt update to add compile flags and require pthread --- CMakeLists.txt | 6 ++++++ thpool.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 973606a..7c959f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.0.0) project(C-Thread-Pool LANGUAGES C) +# define the DEBUG macro when building in debug mode +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DTHPOOL_DEBUG -Wall -Wextra") + +# require pthreads to be available +find_package(Threads REQUIRED) + install(FILES thpool.h DESTINATION include/C-Thread-Pool) add_library(thpool_static STATIC thpool.c) diff --git a/thpool.c b/thpool.c index 3494da2..8802992 100644 --- a/thpool.c +++ b/thpool.c @@ -8,7 +8,7 @@ * ********************************/ -#define _POSIX_C_SOURCE 200809L +#define _GNU_SOURCE #include #include #include