Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Install Qt5.10.1 from Qt website cannot use cmake
Forum Updated to NodeBB v4.3 + New Features

Install Qt5.10.1 from Qt website cannot use cmake

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.3k Views 1 Watching
  • 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
    montanaviking
    wrote on last edited by
    #1

    I had a question regarding the latest Qt download (open source).
    I am running Ubuntu 14.04 64bit and downloaded the Qt5.10.1 installer from Qt for Linux. I installed Qt5.10.1 and tools in /opt/Qt. I was able to compile and run the Qt helloworld program from QtCreator. However, I would like to setup the Qt5.10.1 on CLion with CMake. Unfortunately, CMake within CLion is unable to find the new Qt5.10.1 installation. I believe that the problem is that my installation of Qt5.10.1 from the Qt installer (on the Qt website download) did not include the CMake configuration files such as, Qt5WidgetsConfig.cmake, which I have only for my old Qt5 versions and consequently, cmake cannot build my CLion projects with Qt5.10.1.
    Could anyone kindly guide me as how to get cmake to find and work with my Qt5.10.1 installation? I'm sure I'm missing something obvious but I have not been able to find the answer. Do I need to compile and install Qt5.10.1 from source to obtain the xxxConfig.cmake files?
    Thanks!
    Phil

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From the command line it would be something like:

      mkdir build
      pushd build
      cmake -DCMAKE_PREFIX_PATH=/Path/to/Qt/version/compiler/lib/cmake/ /path/to/cmake_project/
      cmake build
      popd
      

      I don't know CLion, but I'm guessing that you should be able to pass additional parameters to cmake when using it.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • M Offline
        M Offline
        montanaviking
        wrote on last edited by
        #3

        PLEASE DISREGARD my post here. Sorry to waste your time but I just found the solution. I just needed to upgrade my cmake to 3.x.
        Thanks much,
        Phil

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          Thanks for sharing your findings !

          Since you have it working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M Offline
            M Offline
            montanaviking
            wrote on last edited by
            #5

            As I said previously, Please make sure you have a new version of cmake to keep from running into build problems!
            And I needed to direct cmake in CLion to the proper directories to search for the Qt5.10.1 package as well as specifying the 5.10.1 package to avoid catching the old Qt5.2 package I also have as my system Qt. My cmake file is below:
            ####################################
            cmake_minimum_required(VERSION 3.10)
            project(sql)

            set(CMAKE_CXX_STANDARD 17)
            set(CMAKE_PREFIX_PATH /opt/Qt/5.10.1/gcc_64/lib/cmake)

            change /opt/Qt/5.10.1/gcc_64/lib/cmake to your installation directory for cmake config files for your Qt installation

            set(CMAKE_AUTOMOC ON)

            find_package( Qt5Core 5.10.1 REQUIRED )

            be sure to include the 5.x (5.10.1 in my case) version number so you build using the intended Qt version!

            find_package(Qt5Widgets 5.10.1 REQUIRED)
            find_package( Qt5Gui 5.10.1 REQUIRED )
            find_package( Qt5Sql 5.10.1 REQUIRED )

            make sure you do find_package on ALL the Qt modules you'll need for your particular build

            add_executable(sql main.cpp sqlsetup.h)
            target_link_libraries(sql Qt5::Widgets Qt5::Gui Qt5::Core Qt5::Sql)
            ####################################

            Hope this helps anyone else who ran into this!
            Thanks,
            Phil

            1 Reply Last reply
            1

            • Login

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