From c7c3e39e4faa6fe4f6868b8bf83ee20bda5a5faf Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jun 2022 16:14:20 -0400 Subject: 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 --- Utilities/cmliblzma/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Utilities/cmliblzma') diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 0de1e97241..3121fbe4c2 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -166,6 +166,14 @@ 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(NOT CMAKE_SYSTEM_NAME MATCHES "BSD|Darwin|Windows") + add_definitions(-D_XOPEN_SOURCE=600) +endif() + ADD_LIBRARY(cmliblzma STATIC ${LZMA_SRCS}) IF(CMAKE_C_COMPILER_ID STREQUAL "XL") -- cgit v1.2.1