From: Kevin Albertson Date: Sat, 17 May 2025 13:52:36 +0000 (-0400) Subject: test consuming CMake package X-Git-Tag: archive/raspbian/2.11.3-2+rpi1^2~10^2^2~29^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8ed21d9d8d916309869bdbac56312188fbc6291b;p=utf8proc.git test consuming CMake package --- diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2881440..a9cc4cb 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -33,6 +33,21 @@ jobs: path: | build/libutf8proc.* build/Debug/utf8proc.* + - name: Test Consuming (Windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + cmake --install build --prefix tmp/install --config Debug + cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install + cmake --build test/app/build + $env:PATH+=";$PWD/tmp/install/bin" + test/app/build/Debug/app.exe + - name: Test Consuming (Unix) + if: ${{ matrix.os != 'windows-latest' }} + run: | + cmake --install build --prefix tmp/install + cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install + cmake --build test/app/build + test/app/build/app mingw: strategy: @@ -62,3 +77,10 @@ jobs: with: name: windows-mingw64 path: build/libutf8proc.* + - name: Test Consuming + run: | + cmake --install build --prefix tmp/install + cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install -G'MSYS Makefiles' + cmake --build test/app/build + export PATH="$PATH:$(pwd)/tmp/install/bin" + test/app/build/app.exe diff --git a/.gitignore b/.gitignore index ab91d1d..d255134 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ /test/case /test/iscase /test/custom +/test/app/build /tmp/ /mingw_static/ /mingw_shared/ diff --git a/test/app/CMakeLists.txt b/test/app/CMakeLists.txt new file mode 100644 index 0000000..9d9786c --- /dev/null +++ b/test/app/CMakeLists.txt @@ -0,0 +1,6 @@ +# This is a test app to test consuming utf8proc with CMake. +cmake_minimum_required(VERSION 3.16) +project(utf8proc-test) +find_package(utf8proc REQUIRED) +add_executable(app app.c) +target_link_libraries(app utf8proc::utf8proc) diff --git a/test/app/app.c b/test/app/app.c new file mode 100644 index 0000000..4b6f8be --- /dev/null +++ b/test/app/app.c @@ -0,0 +1,9 @@ +#include +#include + +int +main(void) +{ + printf("%s\n", utf8proc_version()); + return 0; +}