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. Best way to share source files between projects
Forum Updated to NodeBB v4.3 + New Features

Best way to share source files between projects

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.7k 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.
  • Q Offline
    Q Offline
    qttester5
    wrote on last edited by
    #1

    I'm working on some general purpose math libraries that I will want to use in multiple projects. Obviously, it makes sense for all the project to reference the same code files so if I fix something it affects all projects.

    One way to do this would be to simply have them all use an INCLUDEPATH and DEPENDPATH that points to the same directory of code files.

    But I was reading this: http://qt-project.org/wiki/IncludingProFiles
    And I'm wondering if it is better to create a .pri Qt project for purposes of inclusion only. Would this be better? Do you have to then manually change the extension from .pro to .pri?

    What's the best setup for sharing code between projects?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I would go for the pri file, you can then easily add dependencies to your library if needed without having to modify all your other projects.

      You should have both, a pro file that allows to build/run tests for your library
      when developing it and a pri file that is used to include your code in other projects (that is if you want to build your library with each project rather that only link to it)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        deleted372
        wrote on last edited by
        #3

        It dependes mostly on your needs.

        I have 2 project sharing some code, in the pro file I have the build settings, in the pri file I have the files inclusion.

        In my case the build settings are project specific, but the include file list is the same for both of them.

        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