1

I'm currently working on a project that required Qt4, as I'm upgrading to Qt5, I tried to change the CMakeList.txt Old file :

find_package (Qt4 REQUIRED)
include (${QT_USE_FILE})
qt4_add_resources (QRC_SOURCES ${RESOURCES})
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
qt4_add_translation( TRANSLATIONS_QM ${TRANSLATIONS} )

New one :

find_package (Qt5Widgets REQUIRED)
qt5_use_modules (${QT_USE_FILE})
qt5_add_resources (QRC_SOURCES ${RESOURCES})
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
qt5_add_translation( TRANSLATIONS_QM ${TRANSLATIONS} )

The error I get is :

CMake Error at CMakeLists.txt:120 (qt5_use_modules):
  qt5_use_modules Macro invoked with incorrect arguments for macro named:
  qt5_use_modules


CMake Error at CMakeLists.txt:123 (qt5_add_translation):
  Unknown CMake command "qt5_add_translation".


-- Configuring incomplete, errors occurred!
See also "/home/maifee/Desktop/Paint/CMakeFiles/CMakeOutput.log".

[Finished]

Complete CMakeList : https://github.com/maifeeulasad/Paint/blob/main/CMakeLists.txt#L119

Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
  • About proper usage of `qt5_use_modules` see [that question](https://stackoverflow.com/questions/28252909/cmake-and-qt5-include-only-takes-one-argument). (In short, in modern the macro should be avoided in favor of `target_link_libraries` call. – Tsyvarev Dec 16 '20 at 13:25

0 Answers0