Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator and runnig CMake custom targets without triggering build
QtWS25 Last Chance

Qt Creator and runnig CMake custom targets without triggering build

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 3 Posters 2.8k 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.
  • SebastianMS Offline
    SebastianMS Offline
    SebastianM
    wrote on last edited by
    #1

    Hi,
    My project uses bunch of custom made bat/python files to generate some source files. Execution of those bat/python files is hidden inside CMake custom targets like :

    add_custom_target(server_build COMMAND "${PROJECT_SOURCE_DIR}/sivi.bat" "X86Win" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
    

    And there is one executable and one library.
    In VS project those target are visible as separate projects in solution and are allowed to be run independently of each other. With result placed in the same build folder.

    Currently as I see it - Qt Creator allows me to define separate RUN targets. However - configuration in this RUN targets is the same as in above custom target.
    alt text
    Beside doubling work (it should get those date from CMake custom target definitions, I don't want do trigger build BEFORE running any of those targets as they generate files essential for build to succeed creating protocol-22 catch.

    In short:

    • how to run custom target WITHOUT triggering build from inside IDE?
    • how to add custom targets to run configuration directly from CMake? Or QtCreator detects what he can run?
    • I would like to make as much changes in CMake files without touching Qt Creator so any one with CMake files could do the same.
    A 1 Reply Last reply
    0
    • SebastianMS SebastianM

      Hi,
      My project uses bunch of custom made bat/python files to generate some source files. Execution of those bat/python files is hidden inside CMake custom targets like :

      add_custom_target(server_build COMMAND "${PROJECT_SOURCE_DIR}/sivi.bat" "X86Win" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
      

      And there is one executable and one library.
      In VS project those target are visible as separate projects in solution and are allowed to be run independently of each other. With result placed in the same build folder.

      Currently as I see it - Qt Creator allows me to define separate RUN targets. However - configuration in this RUN targets is the same as in above custom target.
      alt text
      Beside doubling work (it should get those date from CMake custom target definitions, I don't want do trigger build BEFORE running any of those targets as they generate files essential for build to succeed creating protocol-22 catch.

      In short:

      • how to run custom target WITHOUT triggering build from inside IDE?
      • how to add custom targets to run configuration directly from CMake? Or QtCreator detects what he can run?
      • I would like to make as much changes in CMake files without touching Qt Creator so any one with CMake files could do the same.
      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @SebastianM Someone else had this same question recently.. What I gathered from that thread is that you can't. At least nobody came up with a solution.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • SebastianMS Offline
        SebastianMS Offline
        SebastianM
        wrote on last edited by
        #3

        If those 'custom targets' could be treated by Qt Creator as BUILD targets - then it would solve whole case.
        makefiles treat all targets the same when triggering - only this what is inside differs.

        1 Reply Last reply
        0
        • hungerH Offline
          hungerH Offline
          hunger
          wrote on last edited by
          #4

          I do not understand your question: "Triggering a target" is done by building that specific target.

          Are your custom targets listed in the build configuration of your project? Then you should be able to add more cmake calls building your custom target to your build configuration.

          Or better yet: You make the default build target depend on your custom targets and have cmake trigger them for you. That would work with creator out of the box and also simplifies things everywhere else.

          1 Reply Last reply
          0
          • SebastianMS Offline
            SebastianMS Offline
            SebastianM
            wrote on last edited by SebastianM
            #5

            Hi,
            I would like to be able to start in. uic_server_ivi target separately. Then after its completed (and some valuable files are generated) - then run another target - ie. copy_ivi_..... And so on.

            How can I create possibility to run ie. 3 different targets, each one separately, each one selectable from Build Kit widget?
            I think that's the main question - how to select which target build quickly from gui? Not by manipulating project build steps.

            PS: I found working solution to this.
            alt text

            • I removed all build configurations except Debug. Rename it and set build steps with selected cmake target.
            • Clone this configuration, point it to the same build directory, rename and use different cmake target as build step.
            • Then repeat this for all expected custom target.

            Now in Manage Build Kits I see those targets, I can choose them and with BUILD command execute them.

            This is satisfying solution for now. I would like to be able to set this from inside CMake - another wish...

            1 Reply Last reply
            0

            • Login

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