1+ if (NOT DEFINED LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
2+ if (CMAKE_COMPILER_IS_GNUCXX)
3+ set (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE ON )
4+ elseif ( MSVC )
5+ set (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE OFF )
6+ elseif ( "${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang" )
7+ set (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE ON )
8+ elseif ( "${CMAKE_CXX_COMPILER_ID} " MATCHES "Intel" )
9+ set (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE ON )
10+ endif ()
11+ endif ()
12+
113function (_get_compile_options_from_flags output_var)
214 set (compile_options "" )
315
@@ -8,7 +20,7 @@ function(_get_compile_options_from_flags output_var)
820 check_flag(ADD_EXPLICIT_SIMD_OPT_FLAG ${EXPLICIT_SIMD_OPT_FLAG} ${ARGN} )
921 check_flag(ADD_MISC_MATH_BASIC_OPS_OPT_FLAG ${MISC_MATH_BASIC_OPS_OPT_FLAG} ${ARGN} )
1022
11- if (LLVM_COMPILER_IS_GCC_COMPATIBLE )
23+ if (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE )
1224 if (ADD_FMA_FLAG)
1325 if (LIBC_TARGET_ARCHITECTURE_IS_X86_64)
1426 list (APPEND compile_options "-mavx2" )
@@ -96,7 +108,7 @@ function(_get_common_compile_options output_var flags)
96108
97109 set (compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${compile_flags} ${config_flags} )
98110
99- if (LLVM_COMPILER_IS_GCC_COMPATIBLE )
111+ if (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE )
100112 list (APPEND compile_options "-fpie" )
101113
102114 if (LLVM_LIBC_FULL_BUILD)
@@ -210,7 +222,7 @@ function(_get_common_test_compile_options output_var c_test flags)
210222 ${LIBC_TEST_COMPILE_OPTIONS_DEFAULT}
211223 ${compile_flags} )
212224
213- if (LLVM_COMPILER_IS_GCC_COMPATIBLE )
225+ if (LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE )
214226 list (APPEND compile_options "-fpie" )
215227
216228 if (LLVM_LIBC_FULL_BUILD)
0 commit comments