[CMake] Preferred way to find Qt5 Plugins with CMake 3.x

Michael Jackson mike.jackson at bluequartz.net
Fri Aug 22 10:48:30 EDT 2014


To answer my own question, this bit of code gets me started:

foreach(plugin ${Qt5Gui_PLUGINS})
  get_target_property(_loc ${plugin} LOCATION)
  message("Core Plugin ${plugin} is at location ${_loc}")
endforeach()

Now I need to find the debug versions of the library.?

http://qt-project.org/doc/qt-5/cmake-manual.html
…
Looking on Google gives me this bit of Code:

# Find the QtWidgets library
find_package(Qt5 COMPONENTS Core Widgets Network Gui Concurrent)
get_target_property(qjpeg_loc_release Qt5::QJpegPlugin LOCATION_Release)
message("QJpeg DLL: ${qjpeg_loc_release}")
get_target_property(qjpeg_loc Qt5::QJpegPlugin LOCATION_Debug)
message("QJpeg DLL: ${qjpeg_loc}")

Interestingly on OS X 10.8.5 with CMake 3.0.1 and Qt5 self built I get the following output:
QJpeg DLL: /Users/Shared/Toolkits/Qt-5.3.1/plugins/imageformats/libqjpeg.dylib
QJpeg DLL: /Users/Shared/Toolkits/Qt-5.3.1/plugins/imageformats/libqjpeg.dylib

but on Windows 7x64 with VS2013 and Qt5 (Downloaded from qt-project.org). I get the following:
QJpeg DLL: C:/Developer/x64/Qt5.3.1/5.3/msvc2013_64_opengl/plugins/imageformats/qjpeg.dll
QJpeg DLL: C:/Developer/x64/Qt5.3.1/5.3/msvc2013_64_opengl/plugins/imageformats/qjpegd.dll

I know when I configured Qt5 on OS X i used -debug-and-release and in fact there are _debug versions of the plugins on OS X? Anyone have any thoughts on this? I know in reality on OS X I can mix-n-match Release and Debug libraries but I just want to make sure I am not missing something critical? I have not even tried Linux yet

Thanks for any clarifications
Mike Jackson

On Aug 22, 2014, at 10:02 AM, Michael Jackson <mike.jackson at bluequartz.net> wrote:

> I am trying to locate specific plugins from the Qt5 installation. I guess in previous iterations of FindQt4 possibly the "QT_PLUGINS_DIR" may have been defined because I am using this variable in my Qt4 based codes. I am still trying to wade my way through Qt5 so I maybe missing something obvious on how to do this. Any help is much appreciated.
> 
> Thanks
> Mike Jackson
> dream3d.bluequarz.net
> 



More information about the CMake mailing list