mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
build: Set LLVM_BUILD_STATIC/CLANG_BUILD_STATIC when linking statically.
This is needed since LLVM 20, particularly for Windows.
This commit is contained in:
parent
7733b5dbe6
commit
1bfc71d4da
@ -698,6 +698,13 @@ add_library(zigcpp STATIC ${ZIG_CPP_SOURCES})
|
|||||||
target_compile_features(zigcpp PRIVATE cxx_std_17)
|
target_compile_features(zigcpp PRIVATE cxx_std_17)
|
||||||
set_target_properties(zigcpp PROPERTIES POSITION_INDEPENDENT_CODE ${ZIG_PIE})
|
set_target_properties(zigcpp PROPERTIES POSITION_INDEPENDENT_CODE ${ZIG_PIE})
|
||||||
|
|
||||||
|
if(LLVM_LINK_MODE STREQUAL "static")
|
||||||
|
target_compile_definitions(zigcpp PRIVATE
|
||||||
|
LLVM_BUILD_STATIC
|
||||||
|
CLANG_BUILD_STATIC
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
target_compile_options(zigcpp PRIVATE -Wno-format)
|
target_compile_options(zigcpp PRIVATE -Wno-format)
|
||||||
|
|||||||
@ -706,6 +706,9 @@ const exe_cflags = [_][]const u8{
|
|||||||
"-Wno-type-limits",
|
"-Wno-type-limits",
|
||||||
"-Wno-missing-braces",
|
"-Wno-missing-braces",
|
||||||
"-Wno-comment",
|
"-Wno-comment",
|
||||||
|
// `exe_cflags` is only used for static linking.
|
||||||
|
"-DLLVM_BUILD_STATIC",
|
||||||
|
"-DCLANG_BUILD_STATIC",
|
||||||
};
|
};
|
||||||
|
|
||||||
fn addCmakeCfgOptionsToExe(
|
fn addCmakeCfgOptionsToExe(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user