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. A single project that builds multiple executables
Forum Updated to NodeBB v4.3 + New Features

A single project that builds multiple executables

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 3 Posters 155 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.
  • N Offline
    N Offline
    Noobish
    wrote 18 days ago last edited by
    #1

    Hello. I'm new to this so forgive any errors in terminology.
    So I have two Qt projects, one project that builds as server, and one project that builds a client.
    Until now I've been using "Build all projects"

    But after some changes I see that the two projects share a few C++ classes.

    Can I in some way merge these two projects into one project that builds both the server and the client.

    The benefit would be not having to sync changes to the common code between the two projects and compiling everything would perhaps be quicker since when a common class has been compiled it does not have to be compiled again (I guess)?

    So, how can I accomplish this?
    I use CMake

    S 1 Reply Last reply 15 days ago
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote 18 days ago last edited by
      #2

      Simply use a second add_executable()

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      N 1 Reply Last reply 17 days ago
      3
      • C Christian Ehrlicher
        18 days ago

        Simply use a second add_executable()

        N Offline
        N Offline
        Noobish
        wrote 17 days ago last edited by
        #3

        @Christian-Ehrlicher
        Thanks, I'll have a go and see if I can figure that out.

        1 Reply Last reply
        0
        • N Noobish
          18 days ago

          Hello. I'm new to this so forgive any errors in terminology.
          So I have two Qt projects, one project that builds as server, and one project that builds a client.
          Until now I've been using "Build all projects"

          But after some changes I see that the two projects share a few C++ classes.

          Can I in some way merge these two projects into one project that builds both the server and the client.

          The benefit would be not having to sync changes to the common code between the two projects and compiling everything would perhaps be quicker since when a common class has been compiled it does not have to be compiled again (I guess)?

          So, how can I accomplish this?
          I use CMake

          S Online
          S Online
          SimonSchroeder
          wrote 15 days ago last edited by
          #4

          @Noobish said in A single project that builds multiple executables:

          The benefit would be not having to sync changes to the common code between the two projects and compiling everything would perhaps be quicker since when a common class has been compiled it does not have to be compiled again (I guess)?

          Put common code into a library (which would be yet another project) and link against this library for these two executables.

          Or, like @Christian-Ehrlicher said, combine all projects into one. Even then, it would make sense to have one library and two executables as build targets.

          1 Reply Last reply
          1

          4/4

          19 May 2025, 06:43

          • Login

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