[PATCH] D137917: [cmake] Fix _GNU_SOURCE being added unconditionally

Tom Stellard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 12:29:44 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8da41fe69622: [cmake] Fix _GNU_SOURCE being added unconditionally (authored by Trass3r, committed by tstellar).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137917/new/

https://reviews.llvm.org/D137917

Files:
  clang/CMakeLists.txt
  llvm/cmake/config-ix.cmake


Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -348,7 +348,7 @@
 
 check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
 if( LLVM_USING_GLIBC )
-  add_definitions( -D_GNU_SOURCE )
+  add_compile_definitions(_GNU_SOURCE)
   list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
 endif()
 # This check requires _GNU_SOURCE
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -414,8 +414,6 @@
   endif()
 endif()
 
-add_definitions( -D_GNU_SOURCE )
-
 option(CLANG_BUILD_TOOLS
   "Build the Clang tools. If OFF, just generate build targets." ON)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137917.475243.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221114/578519ff/attachment.bin>


More information about the cfe-commits mailing list