Skip to content

Commit

Permalink
[libc][CMake] Fix build issues of libc on Windows (#102499)
Browse files Browse the repository at this point in the history
Due to an issue mentioned in `llvm/projects/CMakeLists.txt`, libc build
is disabled by default when building with `clang-cl` on Windows. This PR
sets `LLVM_FORCE_BUILD_RUNTIME` to `ON` to bypass this limit for libc
and make libc build with `clang-cl` on Windows.
  • Loading branch information
Lancern authored Aug 8, 2024
1 parent 876ee11 commit 6b78e94
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/cmake/modules/CrossCompile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)

if("libc" IN_LIST LLVM_ENABLE_PROJECTS AND NOT LIBC_HDRGEN_EXE)
set(libc_flags -DLLVM_LIBC_FULL_BUILD=ON -DLIBC_HDRGEN_ONLY=ON)
if(MSVC)
# Due to some issues mentioned in llvm/projects/CMakeLists.txt, libc build is disabled by
# default in the cross target when building with MSVC compatible compilers on Windows. Add
# LLVM_FORCE_BUILD_RUNTIME to bypass this issue and force its building on Windows.
list(APPEND libc_flags -DLLVM_FORCE_BUILD_RUNTIME=ON)
endif()
endif()

add_custom_command(OUTPUT ${${project_name}_${target_name}_BUILD}/CMakeCache.txt
Expand Down

0 comments on commit 6b78e94

Please sign in to comment.