mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
cmake: support setting the dynamic linker
This commit is contained in:
parent
22a97cd235
commit
130fb5cb0f
1 changed files with 8 additions and 1 deletions
|
|
@ -109,6 +109,8 @@ endif()
|
|||
|
||||
set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for")
|
||||
set(ZIG_TARGET_MCPU "native" CACHE STRING "-mcpu parameter to output binaries for")
|
||||
set(ZIG_TARGET_DYNAMIC_LINKER "" CACHE STRING
|
||||
"Override the dynamic linker used by the Zig binary. Default is to auto-detect the dynamic linker.")
|
||||
set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
|
||||
set(ZIG_AR_WORKAROUND off CACHE BOOL "append 'ar' subcommand to CMAKE_AR")
|
||||
|
||||
|
|
@ -897,12 +899,16 @@ if(ZIG_STATIC AND NOT MSVC)
|
|||
else()
|
||||
set(ZIG_STATIC_ARG "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_POSITION_INDEPENDENT_CODE OR ZIG_PIE)
|
||||
set(ZIG_PIE_ARG "-Dpie")
|
||||
else()
|
||||
set(ZIG_PIE_ARG "")
|
||||
endif()
|
||||
if("${ZIG_TARGET_DYNAMIC_LINKER}" STREQUAL "")
|
||||
set(ZIG_DYNAMIC_LINKER_ARG "")
|
||||
else()
|
||||
set(ZIG_DYNAMIC_LINKER_ARG "-Ddynamic-linker=${ZIG_TARGET_DYNAMIC_LINKER}")
|
||||
endif()
|
||||
|
||||
# -Dno-langref is currently hardcoded because building the langref takes too damn long
|
||||
# To obtain these two forms of documentation, run zig build against stage3 rather than stage2.
|
||||
|
|
@ -918,6 +924,7 @@ set(ZIG_BUILD_ARGS
|
|||
${ZIG_PIE_ARG}
|
||||
"-Dtarget=${ZIG_TARGET_TRIPLE}"
|
||||
"-Dcpu=${ZIG_TARGET_MCPU}"
|
||||
${ZIG_DYNAMIC_LINKER_ARG}
|
||||
"-Dversion-string=${RESOLVED_ZIG_VERSION}"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue