c++ - What to use instead of `qt5_use_modules`? -


the qt 5 cmake manual states qt5_use_modules macro deprecated:

this macro obsolete. use target_link_libraries imported targets instead.

... qt5_use_modules more specify link libraries: specifies include directories, necessary compile flags, , more (see full description in linked documentation above).

assuming, then, variable qtmodules contains list of qt modules should used project, "recommended" way replace following "deprecated" cmake line?

qt5_use_modules(${myprojectname} ${qtmodules}) 

the following not work, because not add qt include paths:

    target_link_libraries(${myprojectname} imported ${qtmodules}) 

does qtmodules variable need manually iterated over, include_directories can called each individual module name? seems major step backward qt5_use_modules, simple , "just works." missing something?

the message using imported targets refers generated targets qt5's cmake modules provide you, not should setting imported property on target_link_libraries macro. example, like:

target_link_libraries(${myprojectname} qt5::core qt5::widgets) 

will take care of adding necessary include paths, link paths, , libraries using qt5core , qt5widgets modules.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -