cmake Projekt und QtCreator
-
Hallo zusammen,
ich arbeite unter XUbuntu 20.04 mit der mitgelieferten Qt Version (5.14.2 und Creator 4.13).Ich habe jetzt erfolgreich mein bestehendes QMake Projekt (QtQML / C++) nach cmake protiert. Ein cmake und make in der Kommandozeile läuft fehlerfrei durch und ich kann das Programm auch starten.
Wenn ich jetzt im QtCreator das CMakeLists.txt öffne bekomme ich folgende Meldung:
Führe /usr/bin/cmake -S /home/martin/Entwicklung/qt/qt_gc_cmake -B /home/martin/Entwicklung/qt/qt_gc_cmake/build '-GCodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE:String=Release -DQT_QMAKE_EXECUTABLE:STRING=/usr/lib/qt5/bin/qmake -DCMAKE_PREFIX_PATH:STRING=/usr -DCMAKE_C_COMPILER:STRING=/usr/local/bin/x86_64-pc-linux-gnu-gcc -DCMAKE_CXX_COMPILER:STRING=/usr/local/bin/x86_64-pc-linux-gnu-g++ in /home/martin/Entwicklung/qt/qt_gc_cmake/build aus. -- The C compiler identification is GNU 4.9.3 -- The CXX compiler identification is GNU 4.9.3 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/local/bin/x86_64-pc-linux-gnu-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/local/bin/x86_64-pc-linux-gnu-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at lib-datad/CMakeLists.txt:14 (find_package): By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5", but CMake did not find one. Could not find a package configuration file provided by "Qt5" with any of the following names: Qt5Config.cmake qt5-config.cmake Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR" to a directory containing one of the above files. If "Qt5" provides a separate development package or SDK, be sure it has been installed. -- Configuring incomplete, errors occurred! See also "/home/martin/Entwicklung/qt/qt_gc_cmake/build/CMakeFiles/CMakeOutput.log". CMake process exited with exit code 1. Verstrichene Zeit: 00:02.
Ich habe dann im Netz gesucht und bin auf den Hinweis gestossen folgende Zeile in die CMakeLists.txt aufzunehmen:
if(UNIX) set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/cmake/Qt5") endif()
Jetzt kann zwar QtCreator das Projekt inkl. Unterprojekte öffnen, allerdings bekomme ich folgenden Fehler:
18:26:26: Starte: "/usr/bin/cmake" --build . --target all [ 1%] Automatic MOC and UIC for target datad [ 1%] Built target datad_autogen [ 2%] Building CXX object lib-datad/CMakeFiles/datad.dir/datad_autogen/mocs_compilation.cpp.o In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qatomic.h:46:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1302, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:43, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:48, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:46, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/CAWN4ZDDTK/../../../../lib-datad/source/attribute-decorator.h:4, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/CAWN4ZDDTK/moc_attribute-decorator.cpp:10, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/mocs_compilation.cpp:2: /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support" # error "Qt requires C++11 support" ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:94:13: error: ‘QAtomicOps’ does not name a type typedef QAtomicOps<T> Ops; ^ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:43:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:48, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:46, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/CAWN4ZDDTK/../../../../lib-datad/source/attribute-decorator.h:4, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/CAWN4ZDDTK/moc_attribute-decorator.cpp:10, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/mocs_compilation.cpp:2: /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:97:5: error: ‘QAtomicOpsSupport’ was not declared in this scope Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform"); ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:97:5: error: ‘::IsSupported’ has not been declared Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform"); ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:97:5: error: non-constant condition for static assertion Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform"); ^ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qatomic.h:46:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1302, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:43, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:48, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:46, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/CAWN4ZDDTK/../../../../lib-datad/source/attribute-decorator.h:4, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/CAWN4ZDDTK/moc_attribute-decorator.cpp:10, from /home/martin/Entwicklung/qt/qt_gc_cmake/build/lib-datad/datad_autogen/mocs_compilation.cpp:2: /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:99:14: error: ‘Ops’ has not been declared typename Ops::Type _q_value; ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h: In member function ‘T QBasicAtomicInteger<T>::loadRelaxed() const’: /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:107:45: error: ‘Ops’ has not been declared T loadRelaxed() const noexcept { return Ops::loadRelaxed(_q_value); } ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h: In member function ‘void QBasicAtomicInteger<T>::storeRelaxed(T)’: /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:108:46: error: ‘Ops’ has not been declared void storeRelaxed(T newValue) noexcept { Ops::storeRelaxed(_q_value, newValue); } ^
Hat jemand ein TIp, was ich in der CMake Datei vergessen habe oder woran könnte es liegen, dass das Projekt aus der Kommandozeile läuft und im QtCreator nicht mehr?
Danke für Eure Hilfe.
gruss
martin -
Irgendwo hat der QtCreator noch einen alten gcc compiler gefunden wie Du im CMake outut sehen kannst. Wähle in den Kit-Einstellungen den richtigen gcc aus welcher mitgeliefert wurde.
-
Ok. Danke das wars. Bei mir gibt es unter /usr/local/bin noch einen x86_64-pc-linux-gnu-gcc mit der Version 4.9.3. Wo der herkommt habe ich keine Ahnung.
Ich habe im QtCreator die Definition für diesen Compiler rausgeworfen und den Standard ausgewählt und schon läuft alles.Noch ne zweite Frage: Wie bekomme ich es denn hin, dass QtCreator alle benötigten Dateien in ein Verzeichnis schiebt? Läuft das unter dem Begriff deployment?
gruss
martin