Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Does the cmake config files should be placed in system path?
QtWS25 Last Chance

Does the cmake config files should be placed in system path?

Scheduled Pinned Locked Moved Solved Installation and Deployment
2 Posts 1 Posters 180 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by Mark81
    #1

    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:

    7eb992fd-9c49-4e76-96d7-4960f44a1afe-image.png

    Why the modules' directories are in the system path?
    Is it correct?

    It does not find the Qt6SerialPort module but it is installed:

    ede80b25-8bda-4b4f-beb5-8703b5e8fe9d-Schermata da 2025-02-04 09-32-39.png

    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:

    d322168c-8c38-4e7c-a982-6f9e1b486359-image.png

    0bd57309-c111-4dd6-a4cc-1a4569fcf585-image.png

    Do you see anything wrong in my settings?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mark81
      wrote on last edited by
      #2

      For some reasons I had to click on "Re-configure with initial parameters" and now the variables have the correct path.

      1 Reply Last reply
      1
      • M Mark81 has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved