[llvm] 8da41fe - [cmake] Fix _GNU_SOURCE being added unconditionally
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 12:29:44 PST 2022
Author: Andreas Hollandt
Date: 2022-11-14T12:28:21-08:00
New Revision: 8da41fe69622f35e0a15b5a1754cd670e6057938
URL: https://github.com/llvm/llvm-project/commit/8da41fe69622f35e0a15b5a1754cd670e6057938
DIFF: https://github.com/llvm/llvm-project/commit/8da41fe69622f35e0a15b5a1754cd670e6057938.diff
LOG: [cmake] Fix _GNU_SOURCE being added unconditionally
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D137917
Added:
Modified:
clang/CMakeLists.txt
llvm/cmake/config-ix.cmake
Removed:
################################################################################
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index c9f86d4c9889c..e6cc6e4705428 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 15a7d78b3ac43..28ca8223ce934 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
More information about the llvm-commits
mailing list