cmake: allow user to select static vs dynamic LLVM

This commit is contained in:
daurnimator 2019-07-09 19:03:57 +10:00 committed by Andrew Kelley
parent 9dcddc2249
commit 3a67c13b5d
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,11 @@ endif()
message("Configuring zig version ${ZIG_VERSION}")
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
if(ZIG_STATIC)
set(ZIG_STATIC_LLVM "on")
endif()
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_LIB_DIR_ESCAPED "${ZIG_LIBC_LIB_DIR}")
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_STATIC_LIB_DIR_ESCAPED "${ZIG_LIBC_STATIC_LIB_DIR}")

View File

@ -65,7 +65,7 @@ NEED_TARGET("WebAssembly")
NEED_TARGET("X86")
NEED_TARGET("XCore")
if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug") OR ZIG_STATIC)
if(ZIG_STATIC_LLVM)
execute_process(
COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES