Define _GNU_SOURCE on one place only.
authorJakub Hrozek <jakub.hrozek@gmail.com>
Wed, 13 Aug 2014 07:44:30 +0000 (09:44 +0200)
committerAndreas Schneider <asn@samba.org>
Fri, 15 Aug 2014 08:53:51 +0000 (10:53 +0200)
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>
ConfigureChecks.cmake
cmake/Modules/DefineCompilerFlags.cmake
src/CMakeLists.txt
tests/CMakeLists.txt

index df65411bc1c808ca4915f00939bf86353038fe78..fb73449f985d2d3d932d17d1192ce02721cdaf42 100644 (file)
@@ -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)
index 218f4fe4beb12a57aaf3a3eb71f4b4d132cb7f25..28f4796b7b7269a452437466ac44d425079732c1 100644 (file)
@@ -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)
index b1ab95f8a8eaf5e81fe2a0f13df71fbffc4788cf..4b22d77f9d05395b7908bbe355c843f759657364 100644 (file)
@@ -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})
index d3a4156e53d4cdb49556a00777bad56af848957b..17b12120fe3fd2fc7b407cf86dacabdd9c9813fd 100644 (file)
@@ -6,7 +6,6 @@ include_directories(
   ${CMOCKA_INCLUDE_DIR}
 )
 
-add_definitions(-D_GNU_SOURCE)
 set(TORTURE_LIBRARY torture)
 
 # RFC862 echo server