My question is very similar to this one.
I am trying to build a Qt5 project with Cmake and I am getting this error :
-- QT_DIR: /Users/Shared/Qt/5.12.11/clang_64
-- CMAKE_PREFIX_PATH (should contain the QT install path): /Users/Shared/Qt/5.12.11/clang_64/lib/cmake/Qt5
-- Finding Qt package Core
-- Finding Qt package Network
-- Finding Qt package Gui
-- Finding Qt package Widgets
-- Finding Qt package LinguistTools
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
Could not find a package configuration file provided by "Qt5LinguistTools"
with any of the following names:
Qt5LinguistToolsConfig.cmake
qt5linguisttools-config.cmake
Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
set "Qt5LinguistTools_DIR" to a directory containing one of the above
files. If "Qt5LinguistTools" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
/home/mickael/mega/dev/desktop/src/MEGASync/mega/contrib/cmake/CMakeLists.txt:257 (find_package)
CMakeLists.txt:97 (include)
I am using Ubuntu 22.04, fully updated. Here is the output of apt search qttools
:
Sorting... Done
Full Text Search... Done
qt5-doc/now 5.15.3-1 all [installed,local]
Qt 5 API Documentation
qtcharts5-doc/now 5.15.3-1 all [installed,local]
Qt charts QCH documentation
qtscxml5-doc/now 5.15.3-1 all [installed,local]
Qt SCXML QCH documentation
qtserialbus5-doc/now 5.15.3-1 all [installed,local]
Qt serialbus serial bus access QCH documentation
qttools5-dev-tools/now 5.15.3-1 amd64 [installed,local]
Qt 5 development tools
qttools5-doc/now 5.15.3-1 all [installed,local]
Qt 5 tools documentation
As you can see, qttools5-dev-tools is already installed. There is no qttools5-dev
package, I guess that it has been renamed to qttools5-dev-tools
in Ubuntu 22 repository. The only relevant package that shows up searching for linguist is qttranslations-l10n
and it is already installed :
qttranslations5-l10n/now 5.15.3-1 all [installed,local]
translations for Qt 5
Still, there is no Qt5LinguistTools cmake file and I need to use qt5_add_translation() in my Cmake file.
Do you know which package / how can I use qt translation tools in Cmake?
It turns out that the issue was that I didn't have the "universe" repositories checked in Ubuntu, and qttools5-dev
package is in universe repositories.
The solution was to enabled them, then run apt update
and install the package.