[cmake] Fix _GNU_SOURCE being added unconditionally

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D137917
This commit is contained in:
Andreas Hollandt 2022-11-14 12:27:12 -08:00 committed by Tom Stellard
parent 67d311a5fd
commit 8da41fe696
2 changed files with 1 additions and 3 deletions

View File

@ -414,8 +414,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
endif()
endif()
add_definitions( -D_GNU_SOURCE )
option(CLANG_BUILD_TOOLS
"Build the Clang tools. If OFF, just generate build targets." ON)

View File

@ -348,7 +348,7 @@ endif()
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