# Installing Qt libraries on Linux

**URL:** https://discourse.cmake.org/t/installing-qt-libraries-on-linux/1524
**Category:** Usage
**Tags:** os:linux
**Created:** [July 9, 2020, 7:49am UTC](https://discourse.cmake.org/t/installing-qt-libraries-on-linux/1524 "2020-07-09T07:49:53Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![EosPengwern](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eospengwern/32/3904_2.png) [@EosPengwern](https://discourse.cmake.org/u/EosPengwern)
#### Post date: [November 12, 2020, 9:55pm UTC](https://discourse.cmake.org/t/installing-qt-libraries-on-linux/1524/10 "2020-11-12T21:55:33Z")

</div>

What I actually did was this… First, I worked backwards from the Qt5::Core target to find the directory where the Qt installation had been found:

```
get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
list(GET QT_CORE_INCLUDE_DIRS 0 QT_CORE_MAIN_INCLUDE_DIR)
get_filename_component(QT_MAIN_DIR ${QT_CORE_MAIN_INCLUDE_DIR}/.. ABSOLUTE)	

```

Then in the first instance I did what’s described [here](https://discourse.cmake.org/t/linking-to-installed-qt-libraries-on-linux/1535).

That didn’t quite get me out of the woods, though, because especially once I’d installed PySide2 as well and realised that people could now write scripts using _any_ components of Qt, not just the ones I was using in my C++ application, I decided I’d better just go for it and install the whole Qt directory:

```
    install(DIRECTORY ${QT_MAIN_DIR}/lib/
            DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
            USE_SOURCE_PERMISSIONS)    
    install(DIRECTORY ${QT_MAIN_DIR}/plugins/imageformats/
            DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/qt/plugins/imageformats
            USE_SOURCE_PERMISSIONS) 
    install(DIRECTORY ${QT_MAIN_DIR}/plugins/platforms/
            DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/qt/plugins/platforms
            USE_SOURCE_PERMISSIONS) 

```

This works nicely now.

---

_[View the full topic](https://discourse.cmake.org/t/installing-qt-libraries-on-linux/1524)._
