summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jakub.hrozek@gmail.com>2014-08-13 09:44:30 +0200
committerAndreas Schneider <asn@samba.org>2014-08-15 10:53:51 +0200
commitbc546d05a93794b1f0f1ef02e96f918533c250c3 (patch)
treee9a75dbca1fae4bf032b06a1a77247fdd4897ade
parentbaa8b438f76e66531b26a90c02ab11d4e6c09944 (diff)
downloadsocket_wrapper-bc546d05a93794b1f0f1ef02e96f918533c250c3.tar.gz
socket_wrapper-bc546d05a93794b1f0f1ef02e96f918533c250c3.tar.xz
socket_wrapper-bc546d05a93794b1f0f1ef02e96f918533c250c3.zip
Define _GNU_SOURCE on one place only.
There were several _GNU_SOURCE definitions scaterred in the build system. This patch always adds -D_GNU_SOURCE to the CFLAGS if building on a UNIX platform. Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r--ConfigureChecks.cmake2
-rw-r--r--cmake/Modules/DefineCompilerFlags.cmake1
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--tests/CMakeLists.txt1
4 files changed, 1 insertions, 8 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index df65411..fb73449 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -61,9 +61,7 @@ check_function_exists(snprintf HAVE_SNPRINTF)
check_function_exists(signalfd HAVE_SIGNALFD)
check_function_exists(eventfd HAVE_EVENTFD)
check_function_exists(timerfd_create HAVE_TIMERFD_CREATE)
-set(CMAKE_REQUIRED_FLAGS -D_GNU_SOURCE)
check_function_exists(bindresvport HAVE_BINDRESVPORT)
-set(CMAKE_REQUIRED_FLAGS)
if (UNIX)
diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake
index 218f4fe..28f4796 100644
--- a/cmake/Modules/DefineCompilerFlags.cmake
+++ b/cmake/Modules/DefineCompilerFlags.cmake
@@ -19,6 +19,7 @@ if (UNIX AND NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=pointer-arith -Werror=declaration-after-statement")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration -Werror=write-strings")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
# with -fPIC
check_c_compiler_flag("-fPIC" WITH_FPIC)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b1ab95f..4b22d77 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,11 +2,6 @@ project(libsocket_wrapper C)
include_directories(${CMAKE_BINARY_DIR})
-set_source_files_properties(socket_wrapper.c
- PROPERTIES
- COMPILE_DEFINITIONS
- _GNU_SOURCE)
-
add_library(socket_wrapper SHARED socket_wrapper.c)
target_link_libraries(socket_wrapper ${SWRAP_REQUIRED_LIBRARIES})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d3a4156..17b1212 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,7 +6,6 @@ include_directories(
${CMOCKA_INCLUDE_DIR}
)
-add_definitions(-D_GNU_SOURCE)
set(TORTURE_LIBRARY torture)
# RFC862 echo server