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 240 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 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
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote 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
      3
      • Christian EhrlicherC Christian Ehrlicher

        Simply use a second add_executable()

        N Offline
        N Offline
        Noobish
        wrote 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

          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 Offline
          S Offline
          SimonSchroeder
          wrote 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

          • Login

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