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. Creator / cmake: Only build the executable I want to start?
Qt 6.11 is out! See what's new in the release blog

Creator / cmake: Only build the executable I want to start?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 2 Posters 312 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.
  • A Offline
    A Offline
    Asperamanca
    wrote last edited by Asperamanca
    #1

    My cmake project has about 40 executables that, together, take several seconds to link.
    When doing Test-Driven development with Qt , I'd want to only build and link the unit test I'm working with. I could select only that target in the cmake build steps, but the list is very long (>1000 entries) and tedious to work with. I have not found an easy way to quickly switch between "build only unitTest1" and "build all my default build targets".

    Is there a way to build all build targets when I just say "Build", but only build the desired unit test when I directly start that test?

    cristian-adamC 1 Reply Last reply
    0
    • A Asperamanca

      My cmake project has about 40 executables that, together, take several seconds to link.
      When doing Test-Driven development with Qt , I'd want to only build and link the unit test I'm working with. I could select only that target in the cmake build steps, but the list is very long (>1000 entries) and tedious to work with. I have not found an easy way to quickly switch between "build only unitTest1" and "build all my default build targets".

      Is there a way to build all build targets when I just say "Build", but only build the desired unit test when I directly start that test?

      cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote last edited by
      #2

      @Asperamanca there is the Current executable setting in Build Steps in the Projects pane.

      Then when you edit your unittest and hit build, you would build and run only the unittest and not everything.

      The other option is with the CTest locator ct unittest which will build unittest and run unittest.

      A 2 Replies Last reply
      2
      • A Asperamanca has marked this topic as solved
      • cristian-adamC cristian-adam

        @Asperamanca there is the Current executable setting in Build Steps in the Projects pane.

        Then when you edit your unittest and hit build, you would build and run only the unittest and not everything.

        The other option is with the CTest locator ct unittest which will build unittest and run unittest.

        A Offline
        A Offline
        Asperamanca
        wrote last edited by
        #3

        @cristian-adam Nice, thanks!

        1 Reply Last reply
        0
        • cristian-adamC cristian-adam

          @Asperamanca there is the Current executable setting in Build Steps in the Projects pane.

          Then when you edit your unittest and hit build, you would build and run only the unittest and not everything.

          The other option is with the CTest locator ct unittest which will build unittest and run unittest.

          A Offline
          A Offline
          Asperamanca
          wrote last edited by
          #4

          @cristian-adam said in Creator / cmake: Only build the executable I want to start?:

          Current executable

          Checking "current executable" doesn't make a difference - the other (unrelated) executables are still built.
          Either I need to set an option additionally (which one?), or I would need to uncheck all the other build targets (tedious)

          cristian-adamC 1 Reply Last reply
          0
          • A Asperamanca has marked this topic as unsolved
          • A Asperamanca

            @cristian-adam said in Creator / cmake: Only build the executable I want to start?:

            Current executable

            Checking "current executable" doesn't make a difference - the other (unrelated) executables are still built.
            Either I need to set an option additionally (which one?), or I would need to uncheck all the other build targets (tedious)

            cristian-adamC Offline
            cristian-adamC Offline
            cristian-adam
            wrote last edited by
            #5

            @Asperamanca the another option would be to use ... CMake Presets, there you can define in json the targets that you would want to build ...

            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