# How to create pkgconfig file

**URL:** https://discourse.cmake.org/t/how-to-create-pkgconfig-file/10337
**Category:** Code
**Created:** [March 9, 2024, 4:27pm UTC](https://discourse.cmake.org/t/how-to-create-pkgconfig-file/10337 "2024-03-09T16:27:05Z")
**Posts on this page:** 1
**Showing post:** 35

<div class="post-metadata">

### Author: ![Someone](https://discourse.cmake.org/user_avatar/discourse.cmake.org/someone/32/3271_2.png) [@Someone](https://discourse.cmake.org/u/Someone)
#### Post date: [June 17, 2024, 7:02pm UTC](https://discourse.cmake.org/t/how-to-create-pkgconfig-file/10337/35 "2024-06-17T19:02:00Z")

</div>

Hi! I think the original post is fairly clear in asking specifically about using `get_target_property` to generate a pkg-config file and running into the issue of the generator expressions not having been expanded at the time the file is generated.

My impression is that the original request implies that targets’ properties already implement some complex logic concerned with the includes, and flags, and dependencies, etc, and the author must wish to reuse that logic when generating the `.pc` export. It is a valid use-case to use CMake to generate package info consumable by non-CMake projects. I’m afraid your references to the docopt example, and `man pkg-config`, to `find_package` may have pulled the conversation in a completely different direction and possibly created some… tension.

On the subject matter, I don’t see any `file(GENERATE ...)` in [cmake-pcfilegenerator/PcFileGenerator.cmake at main · antoniovazquezblanco/cmake-pcfilegenerator · GitHub](https://github.com/antoniovazquezblanco/cmake-pcfilegenerator/blob/main/PcFileGenerator.cmake) (from [CMake module to automatically generate pkg-config PC files from targets](https://discourse.cmake.org/t/cmake-module-to-automatically-generate-pkg-config-pc-files-from-targets/8260)) but I do see a `get_target_property`, I wonder how that works.

---

_[View the full topic](https://discourse.cmake.org/t/how-to-create-pkgconfig-file/10337)._
