[libc-commits] [libc] 4dcc2f5 - [libc] Replace LLVM_COMPILER_IS_GCC_COMPATIBLE with a local check. (#119164)
via libc-commits
libc-commits at lists.llvm.org
Sun Dec 8 20:52:55 PST 2024
Author: lntue
Date: 2024-12-08T23:52:52-05:00
New Revision: 4dcc2f5db9d3a9d317aa1acde7adbbe9ec467cb2
URL: https://github.com/llvm/llvm-project/commit/4dcc2f5db9d3a9d317aa1acde7adbbe9ec467cb2
DIFF: https://github.com/llvm/llvm-project/commit/4dcc2f5db9d3a9d317aa1acde7adbbe9ec467cb2.diff
LOG: [libc] Replace LLVM_COMPILER_IS_GCC_COMPATIBLE with a local check. (#119164)
Added:
Modified:
libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 65851f1c86571a..8dcee1ec422464 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -1,3 +1,15 @@
+if(NOT DEFINED LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE ON)
+ elseif( MSVC )
+ set(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE OFF)
+ elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+ set(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE ON)
+ elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" )
+ set(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE ON)
+ endif()
+endif()
+
function(_get_compile_options_from_flags output_var)
set(compile_options "")
@@ -8,7 +20,7 @@ function(_get_compile_options_from_flags output_var)
check_flag(ADD_EXPLICIT_SIMD_OPT_FLAG ${EXPLICIT_SIMD_OPT_FLAG} ${ARGN})
check_flag(ADD_MISC_MATH_BASIC_OPS_OPT_FLAG ${MISC_MATH_BASIC_OPS_OPT_FLAG} ${ARGN})
- if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
if(ADD_FMA_FLAG)
if(LIBC_TARGET_ARCHITECTURE_IS_X86_64)
list(APPEND compile_options "-mavx2")
@@ -96,7 +108,7 @@ function(_get_common_compile_options output_var flags)
set(compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${compile_flags} ${config_flags})
- if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
list(APPEND compile_options "-fpie")
if(LLVM_LIBC_FULL_BUILD)
@@ -210,7 +222,7 @@ function(_get_common_test_compile_options output_var c_test flags)
${LIBC_TEST_COMPILE_OPTIONS_DEFAULT}
${compile_flags})
- if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
list(APPEND compile_options "-fpie")
if(LLVM_LIBC_FULL_BUILD)
More information about the libc-commits
mailing list