From: Andreas Hollandt Date: Mon, 14 Nov 2022 20:27:12 +0000 (-0800) Subject: [cmake] Fix _GNU_SOURCE being added unconditionally X-Git-Tag: upstream/17.0.6~27700 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8da41fe69622f35e0a15b5a1754cd670e6057938;p=platform%2Fupstream%2Fllvm.git [cmake] Fix _GNU_SOURCE being added unconditionally Reviewed By: tstellar Differential Revision: https://reviews.llvm.org/D137917 --- diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index c9f86d4..e6cc6e4 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -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) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 15a7d78..28ca822 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -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