Skip to content

Commit 21055cc

Browse files
Re-apply "Use standard CMake constructs to export the library's targets. (#260)"
Additionally, I have attempted to clean up some CMake issues to make the package's build interface cleaner, in particular, avoiding polluting the parent directory's include path with our config.h file (if PCRE2 is being included as a subdirectory). This re-adds changes from Theodore's commit def175f, and partially reverts changes from Carlo's commit 92d56a1. --- Co-authored-by: Theodore Tsirpanis <[email protected]>
1 parent 2e03e32 commit 21055cc

20 files changed

+215
-200
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ jobs:
121121
../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-macos
122122
../maint/RunSymbolTest install-dir/lib/ ../maint/
123123
124+
- name: Test CMake install interface
125+
run: |
126+
INSTALL_PREFIX=`pwd`/build/install-dir
127+
cd maint/cmake-tests/install-interface
128+
cmake -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -B build
129+
cd build && make
130+
build/test_executable
131+
132+
- name: Test CMake build interface
133+
run: |
134+
cd maint/cmake-tests/build-interface
135+
cmake -B build
136+
cd build && make
137+
build/test_executable
138+
124139
windows:
125140
name: Windows
126141
runs-on: windows-latest
@@ -150,6 +165,21 @@ jobs:
150165
../maint/RunManifestTest.ps1 install-dir ../maint/manifest-cmakeinstall-windows
151166
../maint/RunSymbolTest.ps1 install-dir/bin ../maint/
152167
168+
- name: Test CMake install interface
169+
run: |
170+
$INSTALL_PREFIX = (pwd).Path + "\build\install-dir"
171+
cd maint/cmake-tests/install-interface
172+
cmake -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -B build -A ${{ matrix.arch }}
173+
cmake --build build --config Debug
174+
./build/Debug/test_executable
175+
176+
- name: Test CMake build interface
177+
run: |
178+
cd maint/cmake-tests/build-interface
179+
cmake -B build -A ${{ matrix.arch }}
180+
cmake --build build --config Debug
181+
./build/Debug/test_executable
182+
153183
freebsd:
154184
name: FreeBSD
155185
runs-on: ubuntu-latest
@@ -191,7 +221,7 @@ jobs:
191221
echo "== CMake =="
192222
cd ../build-cmake
193223
194-
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
224+
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
195225
cd build
196226
make -j3
197227
ctest -j3 --output-on-failure
@@ -273,7 +303,7 @@ jobs:
273303
echo "== CMake, 64-bit =="
274304
cd ../build-cmake-64
275305
276-
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
306+
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
277307
cd build
278308
make
279309
ctest -j3 --output-on-failure

.github/workflows/dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ jobs:
200200
run: |
201201
cd build
202202
cmake --install . --prefix install-dir
203+
# Slight hack to trick RunManifestTest to pass with MinSizeRel.
204+
mv install-dir/lib/cmake/pcre2/cmake-targets-minsizerelinux.cmake install-dir/lib/cmake/pcre2/cmake-targets-release.cmake
203205
../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-linux
204206
../maint/RunSymbolTest install-dir/lib/ ../maint/
205207

0 commit comments

Comments
 (0)