Skip to content

Commit

Permalink
Add work-around for Windows Zig cross-compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsGonzo committed Dec 12, 2024
1 parent fdacfa2 commit c6663a0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions program/cpp/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ function (add_sandbox_program name)
if (STRIPPED)
target_link_options(${name} PRIVATE -s)
endif()
if (CMAKE_HOST_WIN32)
# Remove --dependency-file AND the next argument from the link command
# --dependency-file <file> replaced with nothing
# This is a workaround for a bug in either CMake, Zig or LLVM's LLD
get_target_property(link_options ${name} LINK_OPTIONS)
string(REGEX REPLACE "--dependency-file [^ ]+" "" link_options "${link_options}")
set_target_properties(${name} PROPERTIES LINK_OPTIONS "${link_options}")
endif()
target_include_directories(${name} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
Expand Down

0 comments on commit c6663a0

Please sign in to comment.