We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12
The pkgconfig ecosystem
Victor Eijkhout
Fall 2022
1 Eijkhout – Pkgconfig tutorial – Fall 2022
Justification
Pkgconfig is a de facto discovery mechanism for CMake packages. We
discuss: how to discover package how to make your package discoverable
2 Eijkhout – Pkgconfig tutorial – Fall 2022
Using packages through pkgconfig
3 Eijkhout – Pkgconfig tutorial – Fall 2022
Problem
You want to install a package/application
. . . which needs 2 or 3 other packages. cmake \ -D PACKAGE1_INC=/users/my/package1/include \ -D PACKAGE1_LIB=/users/my/package1/lib \ -D PACKAGE2_INC=/users/my/package2/include/packaage \ -D PACKAGE2_LIB=/users/my/package2/lib64 \ ../newpackage
Can this be make simpler?
4 Eijkhout – Pkgconfig tutorial – Fall 2022
Finding packages with ‘pkg config’
Many packages come with a package.pc file
Add that location to PKG_CONFIG_PATH That defines variables in your own cmake file Example: PETSc add $PETSC_DIR/$PETSC_ARCH/lib/pkgconfig to config path, then find_package( PkgConfig REQUIRED ) pkg_check_modules( PETSC REQUIRED petsc ) target_include_directories( program PUBLIC ${PETSC_INCLUDE_DIRS} )
5 Eijkhout – Pkgconfig tutorial – Fall 2022
Eigen
1 cmake_minimum_required( VERSION 3.12 )
2 project( eigentest ) 3
4 find_package( PkgConfig REQUIRED )
5 pkg_check_modules( EIGEN REQUIRED eigen3 ) 6
7 add_executable( eigentest eigentest.cxx )
8 target_include_directories( 9 eigentest PUBLIC 10 ${EIGEN_INCLUDE_DIRS})
Kubernetes: Build and Deploy Modern Applications in a Scalable Infrastructure. The Complete Guide to the Most Modern Scalable Software Infrastructure.: Docker & Kubernetes, #2