How to configure QtCharts withint CMakelist.txt



  • Hi
    There is a fetal error "QtCharts/QChartView: No such file or directory" when running make.
    I tried to add Charts to qt5_use_modules, but it reports no such module.
    Any other feature works fine in my cmake project. My Qt version is 5.9.1. OS is ubuntu 16.04.

    Please Help.

    Best Regards,



  • QtCharts is an add-on module. Probably you forgot installing it.



  • What version of CMake do you have? Something like this should work if you installed the QtCharts add-on and have a recent version of CMake

    ...
    # include other modules above
    find_package(Qt5Charts)
    .
    .
    .
    add_executable(myapp main.cpp)
    # Use the Widgets and Charts modules from Qt 5.
    target_link_libraries(myapp Qt5::Widgets Qt5::Charts)

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.