Does the cmake config files should be placed in system path?
Solved
Installation and Deployment
-
I have a working cmake Qt 6.8.1 project, after upgrading to Qt 6.8.2, my CMakeLists.txt does not work anymore.
The first error was:[cmake] Running /home/mark/Qt/Tools/CMake/bin/cmake -S /home/mark/resources-manager -B /home/mark/software.resources-manager/build/Desktop_Qt_6_8_2-Debug in /home/mark/software.resources-manager/build/Desktop_Qt_6_8_2-Debug. [cmake] -- Could NOT find Qt6SerialPort (missing: Qt6SerialPort_DIR) [cmake] CMake Error at CMakeLists.txt:14 (find_package): [cmake] Found package configuration file: [cmake] [cmake] /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake [cmake] [cmake] but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT [cmake] FOUND. Reason given by package: [cmake] [cmake] Failed to find required Qt component "SerialPort". [cmake] [cmake] Expected Config file at [cmake] "/usr/lib/x86_64-linux-gnu/cmake/Qt6SerialPort/Qt6SerialPortConfig.cmake" [cmake] does NOT exist
This is weird: it uses the correct
cmake
(inside the Qt installation) but then it looks for config files in the system directories. So I checked the project configuration and I noticed this:Why the modules' directories are in the system path?
Is it correct?It does not find the
Qt6SerialPort
module but it is installed:This is my
CMakeLists.txt
file:cmake_minimum_required(VERSION 3.5) project(BRM VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 REQUIRED COMPONENTS Core Widgets Sql SerialPort) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) set(PROJECT_SOURCES main.cpp mainwindow.cpp mainwindow.h mainwindow.ui ) qt_add_executable(BRM MANUAL_FINALIZATION ${PROJECT_SOURCES} resources.qrc formbouquets.h formbouquets.cpp formbouquets.ui formsongs.h formsongs.cpp formsongs.ui formalarms.h formalarms.cpp formalarms.ui formsessions.h formsessions.cpp formsessions.ui formprotocols.h formprotocols.cpp formprotocols.ui formpackages.h formpackages.cpp formpackages.ui tableengine.h tableengine.cpp formcolors.h formcolors.cpp formcolors.ui delegatereal.h formtranslations.h formtranslations.cpp formtranslations.ui dialoglanguages.h dialoglanguages.cpp dialoglanguages.ui dialogcolorpicker.h dialogcolorpicker.cpp dialogcolorpicker.ui femtoserial2.cpp femtoserial2.h delegatesongs.h common.h delegatebool.h tableview.h delegatetime.h delegatecombo.h delegateweekdays.h ) target_link_libraries(BRM PRIVATE Qt${QT_VERSION_MAJOR}::Core) target_link_libraries(BRM PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) target_link_libraries(BRM PRIVATE Qt${QT_VERSION_MAJOR}::Sql) target_link_libraries(BRM PRIVATE Qt${QT_VERSION_MAJOR}::SerialPort) set_target_properties(BRM PROPERTIES ${BUNDLE_ID_OPTION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) include(GNUInstallDirs) install(TARGETS BRM BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(BRM) endif()
Here my kit configuration, it seems ok:
Do you see anything wrong in my settings?
-