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. Project tree files with qmake contains function
QtWS25 Last Chance

Project tree files with qmake contains function

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 526 Views
  • 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.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by beecksche
    #1

    Hi,
    i mentioned that if I add the contains function in the .pro file, where several header and source files are added, these files also are shown in the project tree in Qt Creator even if the contains function returns false.

    contains(DEFINES, MYCLASSES) {
        SOURCES += \
            myclass.cpp
    
        HEADERS += \
            myclass.h
    }
    

    Even if MYCLASSES is not defined, the files myclass.h and myclass.cpp is still shown in the project tree. Here is a screenshot.

    If I add the message function (not shown in the screenshot), I see that the scope isentered when the MYCLASSES is defined.

    I'm using Qt Creator 4.7.2 on macOS.

    But why is Qt Creator still shown these files in the project tree?

    Thanks

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

      Hi,

      Because the project view's role is to show you what's inside your project.

      The fact that the files are shown doesn't mean that they are going to be compiled.

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

      beeckscheB 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        Because the project view's role is to show you what's inside your project.

        The fact that the files are shown doesn't mean that they are going to be compiled.

        beeckscheB Offline
        beeckscheB Offline
        beecksche
        wrote on last edited by
        #3

        @SGaist

        Thanks, make sense!

        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