# CMake module to automatically generate pkg-config PC files from targets

**URL:** https://discourse.cmake.org/t/cmake-module-to-automatically-generate-pkg-config-pc-files-from-targets/8260
**Category:** Community
**Created:** [June 5, 2023, 1:39pm UTC](https://discourse.cmake.org/t/cmake-module-to-automatically-generate-pkg-config-pc-files-from-targets/8260 "2023-06-05T13:39:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![antoniovazquezblanco](https://discourse.cmake.org/user_avatar/discourse.cmake.org/antoniovazquezblanco/32/3448_2.png) [@antoniovazquezblanco](https://discourse.cmake.org/u/antoniovazquezblanco)
#### Post date: [June 5, 2023, 1:39pm UTC](https://discourse.cmake.org/t/cmake-module-to-automatically-generate-pkg-config-pc-files-from-targets/8260/1 "2023-06-05T13:39:09Z")

</div>

While this is a common topic on CMake projects, I found that many many projects repeat the same code with the same objective.

I wanted to reduce CMakeLists.txt boilerplate code and created a PC file generator module that attempts to generate a pkg-config PC file automatically from a target definition.

It is quite basic but it may suit many projects.

The module can be found at [GitHub - antoniovazquezblanco/cmake-pcfilegenerator: Automatically generate PC files for your CMake targets.](https://github.com/antoniovazquezblanco/cmake-pcfilegenerator)
