summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-02 20:14:20 (GMT)
committerBrad King <brad.king@kitware.com>2022-06-04 13:08:27 (GMT)
commitc7c3e39e4faa6fe4f6868b8bf83ee20bda5a5faf (patch)
tree8bd7255e484899809b0e2fa1ff4103292fda0c74 /Utilities/cmcurl
parent3ba324b6b6acf8db34bde5a79563fe9161f9896c (diff)
downloadCMake-c7c3e39e4faa6fe4f6868b8bf83ee20bda5a5faf.zip
CMake-c7c3e39e4faa6fe4f6868b8bf83ee20bda5a5faf.tar.gz
CMake-c7c3e39e4faa6fe4f6868b8bf83ee20bda5a5faf.tar.bz2
Utilities: Activate POSIX APIs even without compiler extensions
Compile some third-party libraries with preprocessor definitions that activate POSIX APIs even when compiler extensions are not enabled. We already do this in libuv, inherited from the upstream buildsystem. This extends commit f034b0f663 (CMake compilation: do not use compiler extensions, 2020-03-14, v3.18.0-rc1~494^2). Issue: #20454
Diffstat (limited to 'Utilities/cmcurl')
-rw-r--r--Utilities/cmcurl/CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 2c0e873..f842270 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -119,6 +119,20 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
endif()
+# Activate POSIX APIs.
+if(CMAKE_SYSTEM_NAME MATCHES "^(AIX|OS400)$")
+ add_definitions(-D_ALL_SOURCE)
+endif()
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux)$")
+ add_definitions(-D_DEFAULT_SOURCE -D_BSD_SOURCE)
+endif()
+if(CMAKE_SYSTEM_NAME MATCHES "^(SunOS)$")
+ add_definitions(-D__EXTENSIONS__)
+endif()
+if(NOT CMAKE_SYSTEM_NAME MATCHES "BSD|Darwin|Windows")
+ add_definitions(-D_XOPEN_SOURCE=600)
+endif()
+
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |