Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Prevent qmake to create executable
Forum Updated to NodeBB v4.3 + New Features

Prevent qmake to create executable

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 1.5k 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.
  • R Offline
    R Offline
    Robiston
    wrote on last edited by
    #1

    Hello,

    I am currently re-organizing my Qt project and wanted to move basic and common classes into a new subdir.
    Since I am using subdirs project, this way, I have common classes, which then can be re-used for my GUI and my Command Line version.
    Nevertheless, I can't figure out how to set-up my pro-file for this common-classes-including subdir, so that no dedicated exe file will be created for this subdir.

    Is there any way to prevent qmake from building a Makefile, which either does not include a "TARGET" property (thus, no executable will be compiled and no qmain is needed), or does not compile a executable but is integrated in my QtCreator project tree.

    Thanks in advance for your help!

    Best regards
    Robiston

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      If you are using
      @
      TEMPLATE = app
      @

      in the template qmake will setup for an application.
      You need to set
      @
      TEMPLATE = lib
      @

      which will result in creating a library for the specific subdir.
      "If you do not use 'app' it may be used since it is the default value.":http://qt-project.org/doc/qt-4.8/qmake-project-files.html#project-templates

      Vote the answer(s) that helped you to solve your issue(s)

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

        Hi and welcome to devnet,

        Your common code should be in a subdir lib project (meaning using the lib template) and then you would link both your applications against that library.

        Hope it helps

        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
        • R Offline
          R Offline
          Robiston
          wrote on last edited by
          #4

          Thank you for your welcoming words.

          Changing to lib Template is indeed a possibility to do this.
          This way, I have the source files in a dedicated folder (e.g. "base") and separated them from other derived projects (e.g. "gui").

          Nevertheless, the solution is a little bit unclean, since a DLL is created by the linker, although not required at all.
          And connecting the source files to the specific projects via interfaces (so that they are using the DLL accordingly) would be over-engineering here.

          More or less, my question related to project code management - so how to organize your code with Qt and QtCreator, if you have common classes, which will be re-used for more specific use cases.
          Example:
          @|__ base ------------,
          |__ gui <---|
          |__ command-line <---'@

          Thanks in advance for your feasible proposals how to manage this.

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

            If you don't want a library then use a pri file that contains the same information as the pro would without TEMPLATE, CONFIG and other variables of this type, just HEADERS, SOURCES and INCLUDEPATH.

            Include that pri in you other projects and you are good to go. Just beware that the files will be compiled several times

            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

            • Login

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