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. Qt5. VERSION of lib
Forum Updated to NodeBB v4.3 + New Features

Qt5. VERSION of lib

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 589 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
    Nik3
    wrote on last edited by
    #1

    Hi All
    I Have project with TEMPLATE = subdirs. Linux, qmake
    ProjBase

    • ProjBase.pro
    • Version.h
    • ProjFirst
      -- ProjFirst.pro
      -- ...
    • ProjSecond
      -- ProjSecond.pro
      -- ...

    how can i use version.h to set lib version in child projects?
    It is necessary that the version changes are in one place and the version of all lib is the same

    Thanks

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      you add Version.h into ProjFirst.pro and ProjSecond.pro like: $$PWD/../Version.h

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        The C++ header file has nothing to do with the version of libraries that may be linked to your executable artefacts. The linker finds libraries in locations specified in your PRO file LIBS variable or in standard locations (and will use the first library found that provides the symbol it is looking for). If you want to centralise the setting of the LIBS variable (or other qmake variables) then you can include a project file fragment, typically named blah.pri, in each subordinate PRO file.

        ProjBase.pro # a subdirs project
        ProjBase.pri # a shared set of settings
        Project1 # sub project 1
            Project1.pro  
        Project2 # sub project 2
            Project2.pro
        

        ProjBase.pri looks like

        LIBS += -L/some/path/lib -lblah
        LIBS += -L/some/other/path/lib -lfoo
        
        

        Project1.pro or Project2.pro look like

        include(../ProjBase.pri)
        ...
        

        If you are trying to ensure that all the projects are built and linked with the same version of Qt then you achieve this by using the qmake from the desired version of Qt.

        1 Reply Last reply
        1
        • N Offline
          N Offline
          Nik3
          wrote on last edited by
          #4

          thanks for answers
          I don't need the QT version, I want to centrally specify the versions of my libraries when they are built.
          For example, Version.h looks like this:

          #ifndef VERSION_H
          #define VERSION_H
          #define V_VERSION 1.0.0.12
          #endif

          How do I specify version 1.0.0.12 when building my libraries using this file.
          Or what other ways are there to do it?

          1 Reply Last reply
          0
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #5

            V_VERSION is used only on display of the version number in your app.
            for your libs define this + build number in cmake or qmake for packaging. And this number can be passed to your app via cmake or qmake variable. Therefore, Version.h may not be needed.

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

              Hi,

              A simple and clean way to do it is to use QMAKE_SUBSTITUTES.

              See a complete example here.

              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
              1

              • Login

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