aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2018-06-15 01:26:04 -0700
committerMarat Dukhan <marat@fb.com>2018-06-15 01:26:04 -0700
commitd3a630495199edda1361afdba38b76ba34a64a2d (patch)
tree9f7ccd97135195134fb369b1d35e3293f0e3a581
parent5d6bb7931a73b2a95ba5cac46bcb35a64ae1b8cc (diff)
downloadcpuinfo-d3a630495199edda1361afdba38b76ba34a64a2d.tar.gz
Always define _GNU_SOURCE in configuration files
-rw-r--r--CMakeLists.txt4
-rwxr-xr-xconfigure.py2
-rw-r--r--src/linux/current.c1
-rw-r--r--src/linux/processors.c1
4 files changed, 2 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c79bdde..0a93b04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,8 +222,6 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
TARGET_COMPILE_DEFINITIONS(cpuinfo INTERFACE CPUINFO_SUPPORTED_PLATFORM=1)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
TARGET_LINK_LIBRARIES(cpuinfo PUBLIC ${CMAKE_THREAD_LIBS_INIT})
- ENDIF()
- IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE _GNU_SOURCE=1)
ENDIF()
IF(IOS)
@@ -308,8 +306,6 @@ IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_MOCK_TESTS)
TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE CPUINFO_LOG_TO_STDIO=1)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
TARGET_LINK_LIBRARIES(cpuinfo_mock PUBLIC ${CMAKE_THREAD_LIBS_INIT})
- ENDIF()
- IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE _GNU_SOURCE=1)
ENDIF()
TARGET_LINK_LIBRARIES(cpuinfo_mock PRIVATE clog)
diff --git a/configure.py b/configure.py
index 39bda07..ef4b27a 100755
--- a/configure.py
+++ b/configure.py
@@ -17,6 +17,8 @@ def main(args):
"CPUINFO_LOG_TO_STDIO": int(not options.mock),
"CPUINFO_MOCK": int(options.mock),
}
+ if build.target.is_linux or build.target.is_android:
+ macros["_GNU_SOURCE"] = 1
build.export_cpath("include", ["cpuinfo.h"])
diff --git a/src/linux/current.c b/src/linux/current.c
index 9d48b92..1fcd7de 100644
--- a/src/linux/current.c
+++ b/src/linux/current.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE 1
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/linux/processors.c b/src/linux/processors.c
index aa6814e..8df06f5 100644
--- a/src/linux/processors.c
+++ b/src/linux/processors.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE 1
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>