Implement use_static_cpp flag for Linux

(cherry picked from commit b0f41909e0)
This commit is contained in:
unvermuthet
2025-03-18 18:44:28 +01:00
committed by David Snopek
parent e299bc623d
commit 863f94de77
2 changed files with 19 additions and 0 deletions

View File

@@ -14,11 +14,25 @@ function(linux_options)
Not implemented as compiler selection is managed by CMake. Look to
doc/cmake.rst for examples.
]]
option(GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" ON)
endfunction()
#[===========================[ Target Generation ]===========================]
function(linux_generate)
set(STATIC_CPP "$<BOOL:${GODOTCPP_USE_STATIC_CPP}>")
target_compile_definitions(godot-cpp PUBLIC LINUX_ENABLED UNIX_ENABLED)
# gersemi: off
target_link_options(
godot-cpp
PUBLIC
$<${STATIC_CPP}:
-static-libgcc
-static-libstdc++
>
)
# gersemi: on
common_compiler_flags()
endfunction()