Skip to content

Commit edefb66

Browse files
godexsoftkuznetsss
authored andcommitted
fix: Static linkage (#1551)
Fixes #1507
1 parent 0054e4b commit edefb66

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

.github/workflows/nightly.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ jobs:
1313
include:
1414
- os: macos14
1515
build_type: Release
16+
static: false
1617
- os: heavy
1718
build_type: Release
19+
static: true
1820
container:
1921
image: rippleci/clio_ci:latest
2022
- os: heavy
2123
build_type: Debug
24+
static: true
2225
container:
2326
image: rippleci/clio_ci:latest
2427
runs-on: [self-hosted, "${{ matrix.os }}"]
@@ -50,6 +53,7 @@ jobs:
5053
conan_profile: ${{ steps.conan.outputs.conan_profile }}
5154
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
5255
build_type: ${{ matrix.build_type }}
56+
static: ${{ matrix.static }}
5357

5458
- name: Build Clio
5559
uses: ./.github/actions/build_clio

src/main/CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ target_sources(clio_server PRIVATE Main.cpp)
1111
target_link_libraries(clio_server PRIVATE clio)
1212

1313
if (static)
14-
target_link_options(clio_server PRIVATE -static)
15-
16-
if (is_gcc AND NOT san)
14+
if (san)
15+
message(FATAL_ERROR "Static linkage not allowed when using sanitizers")
16+
elseif (is_appleclang)
17+
message(FATAL_ERROR "Static linkage not supported on AppleClang")
18+
else ()
1719
target_link_options(
18-
# For now let's assume that we only using libstdc++ under gcc.
20+
# Note: -static-libstdc++ can statically link both libstdc++ and libc++
1921
clio_server PRIVATE -static-libstdc++ -static-libgcc
2022
)
2123
endif ()
22-
23-
if (is_appleclang)
24-
message(FATAL_ERROR "Static linkage not supported on AppleClang")
25-
endif ()
2624
endif ()
2725

2826
set_target_properties(clio_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

0 commit comments

Comments
 (0)