Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtCreator + CMake + PkgConfig



  • I want to build one CMake based project in QtCreator. This project uses pkg-config in cmake with:

    find_package(PkgConfig REQUIRED)
    pkg_check_modules(tinyxml2 REQUIRED IMPORTED_TARGET tinyxml2)
    

    When I run CMake from command line pkg_check_modules works correctly, but when I run from QtCreator I got:

    /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463: error: A required package was not found /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal) CMakeLists.txt:207 (pkg_check_modules)
    

    As I understood , this is a problem of QtCreator. How can I solve this?



  • @imironchik said in QtCreator + CMake + PkgConfig:

    When I run CMake from command line

    Can you post the command line code? do you set environmental variables before calling CMake?



  • Sorry for the question. Everything is fine with pkg-config under CMake in QtCreator. Just was confused with output error, where was not library name written. The problem was in missing package...


Log in to reply