Browse Source

Merge topic 'expat-c-no-extensions'

019af62294 expat: Activate POSIX APIs even without compiler extensions

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !7899
Brad King 3 years ago
parent
commit
efefd80eda
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Utilities/cmexpat/CMakeLists.txt

+ 6 - 0
Utilities/cmexpat/CMakeLists.txt

@@ -6,6 +6,12 @@ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
 ENDIF()
 
+# Activate POSIX APIs.
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux)$")
+  add_definitions(-D_DEFAULT_SOURCE -D_BSD_SOURCE)
+  string(APPEND CMAKE_REQUIRED_DEFINITIONS " -D_DEFAULT_SOURCE -D_BSD_SOURCE")
+endif()
+
 include(ConfigureChecks.cmake)
 configure_file(expat_config.h.cmake expat_config.h @ONLY)