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 5c71f19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions program/cpp/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ 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)
list(REMOVE_ITEM link_options "--dependency-file")
list(REMOVE_ITEM link_options "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${name}.dir/link.d")
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 5c71f19

Please sign in to comment.