Skip to content

Commit

Permalink
[CMAKE] Fix static linkage when building for Windows
Browse files Browse the repository at this point in the history
Summary:
The `-static` flag is obviously a linker flag and not a compilation
flag. It used to work due to the `CMAKE_<C|CXX>_FLAGS` being passed at
link time, hiding the initial issue. The bug is revealed by D4947: while
the cross build still succeed, it is no longer static.

Test Plan:
Run the Gitian build for Windows. Run the `bitcoin-qt.exe` executable
and check it runs and does not complain about missing DLLs.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5023
  • Loading branch information
Fabcien committed Jan 19, 2020
1 parent 33f09e0 commit b53c0fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
list(APPEND CMAKE_RC_FLAGS "-DWINDRES_PREPROC")

# Build all static so there is no dll file to distribute.
add_compiler_flags(-static)
add_linker_flags(-static)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down

0 comments on commit b53c0fc

Please sign in to comment.