${QT_LIBRARIES} in cmake

倖福魔咒の 提交于 2019-12-24 00:55:56

问题


${QT_LIBRARIES} seems to turn out as "" when I do message("${QT_LIBRARIES}") and have a general suspicion that it is no being set properly. In fact it doesnt seem as if any of the attributes are being set properly by find_package(Qt4 REQUIRED). Any ideas?

I have also tried find_package(Qt4 4.6.2 COMPONENTS QtCore QtGui REQUIRED )

and I know that it is finding the individual qt libraries (from cmake-gui).

Thanks in advance!


回答1:


You have to specify the actual Qt libraries you need, like this: (quoted from the man page)

find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtXml REQUIRED )



回答2:


The step I think you are missing is,

include(${QT_USE_FILE})

This will load up the QT_LIBRARIES variable, add the modules you requested to the compiler's include path. If you do not include the use file, then you need to link to Qt core etc individually. Most of this information is in the FindQt4.cmake file that is used when find_package is called (the find modules all document their own behavior).



来源:https://stackoverflow.com/questions/3505858/qt-libraries-in-cmake

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!