Make PackageProject.cmake installable as utility module #161
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/cpm_modules | |
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
- name: Setup cmake | |
uses: jwlawson/[email protected] | |
with: | |
cmake-version: 3.18.4 | |
- name: install PackageProject.cmake and test it | |
run: | | |
cmake -S . -B build/install -DPackageProject.cmake_INSTALL=ON | |
cmake --install build/install --prefix ./install_dir | |
CMAKE_PREFIX_PATH=./install_dir cmake -S test -B build/test_installed_prefix -DTEST_INSTALLED_VERSION_PACKAGEPROJECT=ON | |
cmake --build build/test_installed_prefix | |
cmake --build build/test_installed_prefix --target test | |
sudo cmake --install build/install | |
cmake -S test -B build/test_installed -DTEST_INSTALLED_VERSION_PACKAGEPROJECT=ON | |
cmake --build build/test_installed | |
cmake --build build/test_installed --target test | |
sudo cmake --install build/test_installed | |
- name: test and install local build | |
run: | | |
cmake -S test -B build/local | |
cmake --build build/local | |
cmake --build build/local --target test | |
sudo cmake --install build/local | |
- name: test installed build | |
run: | | |
test -e /usr/local/share/cmake/header_only-1.0/header_onlyConfig.cmake # test if header only library's CMake configs are installed to a ABI-independent dir. | |
cmake -S test -B build/installed -D TEST_INSTALLED_VERSION=1 | |
cmake --build build/installed | |
cmake --build build/installed --target test | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/cpm_modules | |
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
- name: Setup cmake | |
uses: jwlawson/[email protected] | |
with: | |
cmake-version: 3.18.4 | |
- name: build for packaging | |
run: | | |
cmake -S test -B build/local -DTEST_CPACK=YES | |
cmake --build build/local | |
cmake --build build/local --target test | |
cd build/local | |
cpack -G DEB . | |
dpkg -I *deb | grep "Maintainer: Foo Bar <[email protected]>" | |
sudo -E dpkg -i *.deb | |
- name: check if we can explicitly set the runtime destination | |
run: test -e /usr/lib/libruntime_destination_dependency.a | |
- name: test installed build | |
run: | | |
cmake -S test -B build/installed -D TEST_INSTALLED_VERSION=1 | |
cmake --build build/installed | |
cmake --build build/installed --target test |