Digression: pkg-config, CMake, and Other Development Files

Learn how to use pkg-config and CMake modules for discovering the dependencies of more complex packages.

Preface

Packages have to discover their required packages on the computer they’re built on. Since hardcoding the paths for the required headers, libraries, and so on doesn’t scale across different distributions (which may use different paths or configurations of dependencies), there are different mechanisms for dynamically discovering these. It’s important to understand how these work since we’ll interact with these systems for most packages written in statically compiled languages, like C or C++, that have dependencies.

The two most popular methods are pkg-config and CMake modules.

Get hands-on with 1200+ tech skills courses.