I am developing a project with Qt5 and I want to run a process inside CMake script. I need to deploy the application so I want to know the path of Qt5 libraries so I can run on CMake the windeployqt.exe and create the installer of the application. Is there any variable inside the script which has the Qt5 path?
Asked
Active
Viewed 123 times
0
-
Did you try `Qt_DIR`? – Jun 30 '18 at 17:56
-
Yes but unfortunately it has the value /usr/lib/x86_64-linux-gnu/cmake/Qt5 inside cmake directory, qmake isn't there – chatzich Jun 30 '18 at 20:00
-
Possible duplicate of [How to set qt5 path with cmake find\_package on Windows?](https://stackoverflow.com/questions/50764721/how-to-set-qt5-path-with-cmake-find-package-on-windows) – Teivaz Jul 02 '18 at 13:20
1 Answers
0
I use the following snippet in various projects:
# extract the Qt root dir
if (TARGET Qt5::qmake)
get_target_property(_qt5_qmake_path Qt5::qmake LOCATION)
get_filename_component(MY_QT_BIN_DIR ${_qt5_qmake_path} DIRECTORY)
get_filename_component(MY_QT_ROOT_DIR ${MY_QT_BIN_DIR} DIRECTORY)
endif()

James Turner
- 2,425
- 2
- 19
- 24