From a62282aa4e01ead14694769b81f50b4aa3bd6c73 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 19 Dec 2022 19:43:31 +0000 Subject: [PATCH] Make `Wl,--disable-dynamicbase` its own link option seperate from `-static` --- src/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bcb05e22..8d646fe0a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -132,9 +132,12 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 k_roulette.c ) -if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows" AND NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}") - # On MinGW with internal libraries, link the standard library statically - target_link_options(SRB2SDL2 PRIVATE "-static" "-Wl,--disable-dynamicbase") +if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows") + target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase") + if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}") + # On MinGW with internal libraries, link the standard library statically + target_link_options(SRB2SDL2 PRIVATE "-static") + endif() endif() target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)