Skip to content

Commit 832c154

Browse files
committed
fix(ci): add -fPIC for static libs and fix Windows find_package verify step
- Set POSITION_INDEPENDENT_CODE ON for all non-INTERFACE targets in dstools_add_library, fixing Linux linker error when static libs are linked into shared libs - Split Verify find_package(dsfw) CI step into Unix/Windows variants, using shell: cmd on Windows to fix path escaping and MSVC/Ninja availability
1 parent 33770db commit 832c154

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,22 @@ jobs:
257257
- name: Deploy
258258
run: cmake --build ${{github.workspace}}/build --target install
259259

260-
- name: Verify find_package(dsfw)
261-
shell: bash
260+
- name: Verify find_package(dsfw) (Unix)
261+
if: runner.os != 'Windows'
262262
run: |
263263
cmake -B tests/test-find-package/build -S tests/test-find-package -G Ninja \
264264
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
265265
-DCMAKE_PREFIX_PATH="${{github.workspace}}/deploy;${{env.QT_DIR}}/lib/cmake/Qt6/" \
266266
-DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake
267267
cmake --build tests/test-find-package/build
268268
269+
- name: Verify find_package(dsfw) (Windows)
270+
if: runner.os == 'Windows'
271+
shell: cmd
272+
run: |
273+
cmake -B tests/test-find-package/build -S tests/test-find-package -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_PREFIX_PATH="${{github.workspace}}/deploy;${{env.QT_DIR}}/lib/cmake/Qt6/" -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
274+
cmake --build tests/test-find-package/build
275+
269276
- name: Set Commit ID
270277
shell: bash
271278
run: |

cmake/DstoolsHelpers.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ function(dstools_add_library target_name)
102102
endif()
103103

104104
add_library(${target_name} ${_type} ${_sources})
105+
106+
# Ensure static libraries can be linked into shared libraries on Linux
107+
set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
105108
else()
106109
add_library(${target_name} INTERFACE)
107110
endif()

0 commit comments

Comments
 (0)