Skip to content

Commit 71685ea

Browse files
committed
Use find_compiler_rt_library
1 parent f8a8965 commit 71685ea

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

flang-rt/CMakeLists.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,9 @@ check_cxx_source_compiles(
160160
HAVE_DECL_STRERROR_S)
161161

162162

163-
# Search for clang_rt.builtins library.
163+
# Search for clang_rt.builtins library. Need in addition to msvcrt.
164164
if (WIN32)
165-
execute_process(
166-
COMMAND "${CMAKE_CXX_COMPILER}" "-print-libgcc-file-name" "-rtlib=compiler-rt"
167-
RESULT_VARIABLE CXX_COMPILER_PRINT_LIBGCC_PATH_FAILURE
168-
OUTPUT_VARIABLE CXX_COMPILER_PRINT_LIBGCC_PATH_RESULT
169-
ERROR_QUIET
170-
)
171-
if (NOT CXX_COMPILER_PRINT_LIBGCC_PATH_FAILURE AND CXX_COMPILER_PRINT_LIBGCC_PATH_RESULT)
172-
string(STRIP "${CXX_COMPILER_PRINT_LIBGCC_PATH_RESULT}" FLANG_RT_LIBCALL)
173-
else ()
174-
set(FLANG_RT_LIBCALL "")
175-
endif ()
165+
find_compiler_rt_library(builtins FLANG_RT_BUILTINS_LIBRARY)
176166
endif ()
177167

178168

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ function (add_flangrt_library name)
125125
# functions in some cases like 128-bit integer math (__udivti3, __modti3,
126126
# __fixsfti, __floattidf, ...) that msvc does not support. We are injecting a
127127
# dependency to Compiler-RT's builtin library where these are implemented.
128-
if (MSVC AND (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") AND FLANG_RT_LIBCALL)
129-
target_compile_options(${name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:-Xclang>$<$<COMPILE_LANGUAGE:Fortran>:-Xflang>" "--dependent-lib=${FLANG_RT_LIBCALL}")
128+
if (MSVC AND (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") AND FLANG_RT_BUILTINS_LIBRARY)
129+
target_compile_options(${name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:-Xclang>$<$<COMPILE_LANGUAGE:Fortran>:-Xflang>" "--dependent-lib=${FLANG_RT_BUILTINS_LIBRARY}")
130130
endif ()
131131

132132
# Non-GTest unittests depend on LLVMSupport

0 commit comments

Comments
 (0)