Skip to content

Commit 8ed21d9

Browse files
committed
test consuming CMake package
1 parent e3d29ea commit 8ed21d9

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ jobs:
3333
path: |
3434
build/libutf8proc.*
3535
build/Debug/utf8proc.*
36+
- name: Test Consuming (Windows)
37+
if: ${{ matrix.os == 'windows-latest' }}
38+
run: |
39+
cmake --install build --prefix tmp/install --config Debug
40+
cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install
41+
cmake --build test/app/build
42+
$env:PATH+=";$PWD/tmp/install/bin"
43+
test/app/build/Debug/app.exe
44+
- name: Test Consuming (Unix)
45+
if: ${{ matrix.os != 'windows-latest' }}
46+
run: |
47+
cmake --install build --prefix tmp/install
48+
cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install
49+
cmake --build test/app/build
50+
test/app/build/app
3651
3752
mingw:
3853
strategy:
@@ -62,3 +77,10 @@ jobs:
6277
with:
6378
name: windows-mingw64
6479
path: build/libutf8proc.*
80+
- name: Test Consuming
81+
run: |
82+
cmake --install build --prefix tmp/install
83+
cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install -G'MSYS Makefiles'
84+
cmake --build test/app/build
85+
export PATH="$PATH:$(pwd)/tmp/install/bin"
86+
test/app/build/app.exe

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
/test/case
2929
/test/iscase
3030
/test/custom
31+
/test/app/build
3132
/tmp/
3233
/mingw_static/
3334
/mingw_shared/

test/app/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is a test app to test consuming utf8proc with CMake.
2+
cmake_minimum_required(VERSION 3.16)
3+
project(utf8proc-test)
4+
find_package(utf8proc REQUIRED)
5+
add_executable(app app.c)
6+
target_link_libraries(app utf8proc::utf8proc)

test/app/app.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <stdio.h>
2+
#include <utf8proc.h>
3+
4+
int
5+
main(void)
6+
{
7+
printf("%s\n", utf8proc_version());
8+
return 0;
9+
}

0 commit comments

Comments
 (0)