From 676ba9a0468bb980e1b87e11b84124c92e066d38 Mon Sep 17 00:00:00 2001 From: Harshitha K P Date: Sat, 11 Jan 2020 03:51:30 +0530 Subject: [PATCH] src: suppress warnings in uvwasi.c (#70) Define `_GNU_SOURCE` and `_POSIX_C_SOURCE` to suppress compilation warnings. Refs: https://github.com/nodejs/node/pull/31139 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bdaf9bf..fac8841 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,10 @@ if(APPLE) set(CMAKE_MACOSX_RPATH ON) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND uvwasi_defines _GNU_SOURCE _POSIX_C_SOURCE=200112) +endif() + include(FetchContent) ## https://libuv.org FetchContent_Declare( @@ -65,6 +69,7 @@ endif() ## Static library target. add_library(uvwasi_a STATIC ${uvwasi_sources}) +target_compile_definitions(uvwasi_a PRIVATE ${uvwasi_defines}) target_compile_options(uvwasi_a PRIVATE ${uvwasi_cflags}) target_include_directories(uvwasi_a PRIVATE ${PROJECT_SOURCE_DIR}/include) if(CODE_COVERAGE)