aboutsummaryrefslogtreecommitdiffstats
path: root/pkg-test/test-cmake
blob: 868ce36300b8c3acf7a78e51f2a0daf873fb718b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#
# Test that the installed qpdf development packages enable a qpdf
# application to be built with cmake using qpdf's cmake package
# information. Requires cmake as well as libqpdf development
# dependencies.
#
set -ex

TMP=$1
if [ ! -d "$TMP" ]; then
    echo 1>&2 "Usage: $0 tmp-dir"
    exit 2
fi

WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h)

cp pkg-test/qpdf-version.cc pkg-test/CMakeLists.txt $TMP
cd $TMP
cmake -S . -B build
cmake --build build
if [ "$(./build/qpdf-version)" != "$WANTED_VERSION" ]; then
    echo 1>&2 "Failed to get correct qpdf version from cmake test"
    exit 2
fi