@@ -121,6 +121,50 @@ jobs:
121
121
../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-macos
122
122
../maint/RunSymbolTest install-dir/lib/ ../maint/
123
123
124
+ - name : Test CMake install interface
125
+ run : |
126
+ INSTALL_PREFIX=`pwd`/build/install-dir
127
+ cd maint/cmake-tests/install-interface
128
+
129
+ for useStaticLibs in ON OFF; do
130
+ echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
131
+ rm -rf build
132
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build
133
+ (cd build; make)
134
+ ./build/test_executable
135
+ otool -L ./build/test_executable
136
+ if [ $useStaticLibs = ON ]; then
137
+ (otool -L ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in otool output" && exit 1)
138
+ else
139
+ # Test that the shared library is actually linked in
140
+ (otool -L ./build/test_executable | grep -q "@rpath/libpcre2-8.0.dylib") || (echo "Error: Shared library not linked in" && exit 1)
141
+ fi
142
+ done
143
+
144
+ - name : Test CMake build interface
145
+ run : |
146
+ BUILD_DIR=`pwd`
147
+ cp -rp maint/cmake-tests/build-interface ../cmake-tests-build-interface
148
+ cd ../cmake-tests-build-interface
149
+ ln -s "$BUILD_DIR" pcre2
150
+
151
+ for buildLibs in "ON;OFF" "OFF;ON"; do
152
+ static=`echo $buildLibs | cut -d';' -f1`
153
+ shared=`echo $buildLibs | cut -d';' -f2`
154
+ echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$static and BUILD_SHARED_LIBS=$shared =="
155
+ rm -rf build
156
+ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC_LIBS=$static -DBUILD_SHARED_LIBS=$shared -B build
157
+ (cd build; make)
158
+ ./build/test_executable
159
+ otool -L ./build/test_executable
160
+ if [ $static = ON ]; then
161
+ (otool -L ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in ldd output" && exit 1)
162
+ else
163
+ # Test that the shared library is actually linked in
164
+ (otool -L ./build/test_executable | grep -q "@rpath/libpcre2-8.0.dylib") || (echo "Error: Shared library not linked in" && exit 1)
165
+ fi
166
+ done
167
+
124
168
windows :
125
169
name : Windows
126
170
runs-on : windows-latest
@@ -165,6 +209,66 @@ jobs:
165
209
../maint/RunManifestTest.ps1 install-dir ../maint/manifest-cmakeinstall-windows
166
210
../maint/RunSymbolTest.ps1 install-dir/bin ../maint/
167
211
212
+ - name : Test CMake install interface
213
+ run : |
214
+ $INSTALL_PREFIX = (pwd).Path + "\build\install-dir"
215
+ cd maint/cmake-tests/install-interface
216
+
217
+ $vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
218
+ $dumpbin = & $vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe | Select-Object -First 1
219
+
220
+ foreach ($useStaticLibs in @("ON", "OFF")) {
221
+ echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
222
+ if (Test-Path build) { rm -Recurse -Force build }
223
+ cmake "-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX" "-DPCRE2_USE_STATIC_LIBS=$useStaticLibs" -B build -A ${{ matrix.arch }}
224
+ cmake --build build --config Release
225
+ ./build/Release/test_executable.exe
226
+ & $dumpbin /dependents ./build/Release/test_executable.exe
227
+ if ($useStaticLibs -eq "ON") {
228
+ if ((& $dumpbin /dependents ./build/Release/test_executable.exe | Out-String).Contains("pcre2")) {
229
+ Write-Error "Error: PCRE2 found in dumpbin output"
230
+ exit 1
231
+ }
232
+ } else {
233
+ # Test that the shared library is actually linked in
234
+ if (-not ((& $dumpbin /dependents ./build/Release/test_executable.exe | Out-String).Contains("pcre2-8.dll"))) {
235
+ Write-Error "Error: Shared library not linked in"
236
+ exit 1
237
+ }
238
+ }
239
+ }
240
+
241
+ - name : Test CMake build interface
242
+ run : |
243
+ $BUILD_DIR = (pwd).Path
244
+ cp -Recurse -Path maint/cmake-tests/build-interface ../cmake-tests-build-interface
245
+ cd ../cmake-tests-build-interface
246
+ New-Item -ItemType SymbolicLink -Path "pcre2" -Target "$BUILD_DIR"
247
+
248
+ $vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
249
+ $dumpbin = & $vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe | Select-Object -First 1
250
+
251
+ foreach ($buildLibs in @(@{static="ON"; shared="OFF"}, @{static="OFF"; shared="ON"})) {
252
+ echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$($buildLibs.static) =="
253
+ if (Test-Path build) { rm -Recurse -Force build }
254
+ cmake "-DBUILD_STATIC_LIBS=$($buildLibs.static)" "-DBUILD_SHARED_LIBS=$($buildLibs.shared)" -B build -A ${{ matrix.arch }}
255
+ cmake --build build --config Debug
256
+ ./build/Debug/test_executable.exe
257
+ & $dumpbin /dependents ./build/Debug/test_executable.exe
258
+ if ($buildLibs.static -eq "ON") {
259
+ if ((& $dumpbin /dependents ./build/Debug/test_executable.exe | Out-String).Contains("pcre2")) {
260
+ Write-Error "Error: PCRE2 found in dumpbin output"
261
+ exit 1
262
+ }
263
+ } else {
264
+ # Test that the shared library is actually linked in
265
+ if (-not ((& $dumpbin /dependents ./build/Debug/test_executable.exe | Out-String).Contains("pcre2-8d.dll"))) {
266
+ Write-Error "Error: Shared library not linked in"
267
+ exit 1
268
+ }
269
+ }
270
+ }
271
+
168
272
freebsd :
169
273
name : FreeBSD
170
274
runs-on : ubuntu-latest
@@ -206,7 +310,7 @@ jobs:
206
310
echo "== CMake =="
207
311
cd ../build-cmake
208
312
209
- cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build
313
+ cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release - B build
210
314
cd build
211
315
make -j3
212
316
ctest -j3 --output-on-failure
@@ -288,7 +392,7 @@ jobs:
288
392
echo "== CMake, 64-bit =="
289
393
cd ../build-cmake-64
290
394
291
- CC="cc -m64" cmake -DNCURSES_LIBRARY=termcap -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_SOLARIS_CC" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build
395
+ CC="cc -m64" cmake -DNCURSES_LIBRARY=termcap -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_SOLARIS_CC" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release - B build
292
396
cd build
293
397
make
294
398
ctest -j3 --output-on-failure
0 commit comments