Static linkage (#1377)

Fixes #1300
This commit is contained in:
Alex Kremer
2024-04-25 16:51:16 +01:00
committed by GitHub
parent c00342c792
commit 0dcbbf9afa
5 changed files with 33 additions and 8 deletions

View File

@@ -9,10 +9,20 @@ target_compile_features(clio PUBLIC cxx_std_23)
add_executable(clio_server)
target_sources(clio_server PRIVATE Main.cpp)
target_link_libraries(clio_server PRIVATE clio)
target_link_options(
# For now let's assume that we only using libstdc++ under gcc.
#
# TODO: libc++ static linkage in https://github.com/XRPLF/clio/issues/1300
clio_server PRIVATE $<$<AND:$<BOOL:${is_gcc}>,$<NOT:$<BOOL:${san}>>>:-static-libstdc++ -static-libgcc>
)
if (static)
target_link_options(clio_server PRIVATE -static)
if (is_gcc AND NOT san)
target_link_options(
# For now let's assume that we only using libstdc++ under gcc.
clio_server PRIVATE -static-libstdc++ -static-libgcc
)
endif ()
if (is_appleclang)
message(FATAL_ERROR "Static linkage not supported on AppleClang")
endif ()
endif ()
set_target_properties(clio_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})