# Finding library names and locations

**URL:** <https://discourse.cmake.org/t/finding-library-names-and-locations/1622>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [July 25, 2020, 5:23pm UTC](https://discourse.cmake.org/t/finding-library-names-and-locations/1622 "2020-07-25T17:23:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![normvcr](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/n/da6949/32.png) [@normvcr](https://discourse.cmake.org/u/normvcr)\
**Post date:** [July 25, 2020, 5:23pm UTC](https://discourse.cmake.org/t/finding-library-names-and-locations/1622/1 "2020-07-25T17:23:54Z")

</div>

The command  
‘’‘find\_package(Qt5 COMPONENTS Widgets REQUIRED CONFIG)’’’  
seems to work, as Qt5\_FOUND is true, and _Qt5Widgets\_INCLUDE\_DIRS_ has the correct include folders. However, _Qt5Widgets\_LIBRARIES_ only has “Qt5::Widgets”. How do I get hold of the the Widgets library names and their folders?

---

<div class="post-metadata">

**Author:** ![airwin](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/f4b2a3/32.png) [@airwin](https://discourse.cmake.org/u/airwin)\
**Post date:** [July 26, 2020, 10:25pm UTC](https://discourse.cmake.org/t/finding-library-names-and-locations/1622/2 "2020-07-26T22:25:34Z")

</div>

Qt5::Widgets is a target rather than a library. But that allows you  
to use `target_link_libraries(<your target name> Qt5::Widgets)` to  
set properties on `<your target name>` including the location of  
needed Qt5 headers, the location of the appropriate Qt5 library, etc.  
And if target\_link\_libraries is not enough, you can use generator  
expressions based on the Qt5::Widgets target to figure out everything  
else you might need to build `<your target name>`.

---

<div class="post-metadata">

**Author:** ![normvcr](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/n/da6949/32.png) [@normvcr](https://discourse.cmake.org/u/normvcr)\
**Post date:** [July 27, 2020, 1:22am UTC](https://discourse.cmake.org/t/finding-library-names-and-locations/1622/3 "2020-07-27T01:22:28Z")

</div>

Thanks for the hints! I found generator expressions to be most useful e.g.  
**file( GENERATE**  
\*\* OUTPUT wname.txt\*\*  
\*\* CONTENT $\<TARGET\_LINKER\_FILE\_NAME:Qt5::Widgets\>\n\*\*  
\*\* )\*\*  
creates the file wname.txt with content  
**libQt5Widgets.so.5.14.2**
