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. QtCreator best CMake/Conan workflow?
Forum Updated to NodeBB v4.3 + New Features

QtCreator best CMake/Conan workflow?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.3k Views 2 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.
  • R Offline
    R Offline
    rhvonlehe
    wrote on 6 Feb 2023, 20:00 last edited by
    #1

    I'm wondering if anyone has a better QtCreator developer workflow for the QtCreator/Conan/CMake combination. I've installed the Conan plugin with QtCreator 9 and read some of the documentation, but it wants to add the conan install step as part of the build. In my experience, though, the Conan install step is what comes before the CMake configuration step, followed then by the CMake build step. Perhaps adding the conan install step as part of the build, as the plugin does, acts as a check to make sure your Conan dependencies stay up to date with any subsequent conanfile.py changes?

    My usage is:

    • create a build folder
    • run something like conan install ../<project-folder> -pr <profile> --build=missing on the command line in the build folder
    • open the CMakeLists.txt from within QtCreator, telling it to use the build folder I created.
    • watch the CMake configuration fail (toolchain file not specified yet), then go into the project build settings and manually type in the CMAKE_TOOLCHAIN_FILE as a value to use in QtCreator's CMake "initial configuration" tab.
    • Re-run CMake configuration - i.e. "Re-configure with initial parameters"
    • build the project

    the clunky part is having to do the Conan piece outside the IDE, which prevents QtCreator from being able to create the build folders on your behalf. Also, since my toolchain is generated from the Conan profile the QtCreator kit is mostly unused. It doesn't seem appropriate to name the cmake toolchain file in the kit because the toolchain file is auto-generated.

    C 1 Reply Last reply 7 Feb 2023, 11:32
    0
    • R rhvonlehe
      6 Feb 2023, 20:00

      I'm wondering if anyone has a better QtCreator developer workflow for the QtCreator/Conan/CMake combination. I've installed the Conan plugin with QtCreator 9 and read some of the documentation, but it wants to add the conan install step as part of the build. In my experience, though, the Conan install step is what comes before the CMake configuration step, followed then by the CMake build step. Perhaps adding the conan install step as part of the build, as the plugin does, acts as a check to make sure your Conan dependencies stay up to date with any subsequent conanfile.py changes?

      My usage is:

      • create a build folder
      • run something like conan install ../<project-folder> -pr <profile> --build=missing on the command line in the build folder
      • open the CMakeLists.txt from within QtCreator, telling it to use the build folder I created.
      • watch the CMake configuration fail (toolchain file not specified yet), then go into the project build settings and manually type in the CMAKE_TOOLCHAIN_FILE as a value to use in QtCreator's CMake "initial configuration" tab.
      • Re-run CMake configuration - i.e. "Re-configure with initial parameters"
      • build the project

      the clunky part is having to do the Conan piece outside the IDE, which prevents QtCreator from being able to create the build folders on your behalf. Also, since my toolchain is generated from the Conan profile the QtCreator kit is mostly unused. It doesn't seem appropriate to name the cmake toolchain file in the kit because the toolchain file is auto-generated.

      C Offline
      C Offline
      cristian-adam
      wrote on 7 Feb 2023, 11:32 last edited by
      #2

      Qt Creator's CMake project manager has the Package manager auto-setup feature. I blogged about it here: Qt Creator: CMake package-manager auto-setup.

      This will inject the share\qtcreator\package-manager\auto-setup.cmake CMake code into your CMake project via CMAKE_PROJECT_INCLUDE_BEFORE variable.

      For Conan it will use the conan-cmake project, which would run the conan install step.

      In Qt Creator 9 you need to enable the feature, see:
      alt text

      R 1 Reply Last reply 10 Feb 2023, 03:14
      1
      • R rhvonlehe has marked this topic as solved on 7 Feb 2023, 16:20
      • C cristian-adam
        7 Feb 2023, 11:32

        Qt Creator's CMake project manager has the Package manager auto-setup feature. I blogged about it here: Qt Creator: CMake package-manager auto-setup.

        This will inject the share\qtcreator\package-manager\auto-setup.cmake CMake code into your CMake project via CMAKE_PROJECT_INCLUDE_BEFORE variable.

        For Conan it will use the conan-cmake project, which would run the conan install step.

        In Qt Creator 9 you need to enable the feature, see:
        alt text

        R Offline
        R Offline
        rhvonlehe
        wrote on 10 Feb 2023, 03:14 last edited by
        #3

        @cristian-adam Thank you

        1 Reply Last reply
        1

        1/3

        6 Feb 2023, 20:00

        • Login

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