Skip to content

Commit ebaeb7a

Browse files
authored
Merge pull request #495 from JacobBarthelmeh/cmake_build
fix for vcpkg build
2 parents 5a093ac + ee41a05 commit ebaeb7a

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

.github/workflows/cmake-build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,50 @@ jobs:
182182
LD_LIBRARY_PATH="$GITHUB_WORKSPACE/install/lib" \
183183
ctest -C Release --output-on-failure
184184
fi
185+
186+
# Verify that a static-library build can be installed and its exported
187+
# CMake targets are self-consistent. The matrix builds above use
188+
# WITH_WOLFSSL (shared library) and do not catch this because CMake only
189+
# enforces export-set completeness for static libraries: any CMake target
190+
# in a static library's PRIVATE link chain must be exported or wrapped in
191+
# $<BUILD_INTERFACE:...>.
192+
cmake-static-export:
193+
name: CMake static export check
194+
runs-on: ubuntu-latest
195+
steps:
196+
- uses: actions/checkout@master
197+
198+
- name: Install cmake
199+
run: |
200+
sudo apt-get update
201+
sudo apt-get install -y cmake
202+
203+
- name: Checkout wolfssl
204+
uses: actions/checkout@master
205+
with:
206+
repository: wolfssl/wolfssl
207+
path: wolfssl
208+
209+
- name: Build and install wolfssl
210+
working-directory: ./wolfssl
211+
run: |
212+
mkdir build && cd build
213+
cmake -DWOLFSSL_TPM=yes -DWOLFSSL_INSTALL=yes \
214+
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
215+
-DCMAKE_C_FLAGS="-DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP" ..
216+
cmake --build .
217+
cmake --install .
218+
219+
- name: Build and install wolftpm (static, cmake-config wolfssl)
220+
run: |
221+
mkdir build && cd build
222+
cmake \
223+
-DBUILD_SHARED_LIBS=OFF \
224+
-DWOLFTPM_EXAMPLES=no \
225+
-DWOLFTPM_FWTPM=no \
226+
-DWOLFTPM_BUILD_OUT_OF_TREE=yes \
227+
-DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/install" \
228+
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
229+
..
230+
cmake --build .
231+
cmake --install .

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ endif()
456456
# of wolftpm's export set (it is build-tree-only). Downstream consumers of
457457
# wolftpm should `find_package(wolfssl)` themselves before find_package(wolftpm).
458458
if(BUILD_WOLFTPM_LIB)
459-
target_link_libraries(wolftpm PRIVATE wolftpm_wolfssl_dep)
459+
target_link_libraries(wolftpm PRIVATE $<BUILD_INTERFACE:wolftpm_wolfssl_dep>)
460460
endif()
461461

462462
# fwTPM requires wolfCrypt

0 commit comments

Comments
 (0)