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. Exclude source from build

Exclude source from build

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

    Hi Folks,

    My use case is the following:
    I have some classes (source and header) that implement Windows, Linux or MAC dependent part.
    How should I edit my .pro file for exclude the appropriate classes from the build, BUT they stay there in the project side bar for reading or even editing them?
    Can I do this via the .pro file?

    Regards,
    Norbert

    raven-worxR kshegunovK 2 Replies Last reply
    0
    • M moravas

      Hi Folks,

      My use case is the following:
      I have some classes (source and header) that implement Windows, Linux or MAC dependent part.
      How should I edit my .pro file for exclude the appropriate classes from the build, BUT they stay there in the project side bar for reading or even editing them?
      Can I do this via the .pro file?

      Regards,
      Norbert

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @moravas
      i can only think of something like this:

      win32 {
          SOURCES += win.cpp
      } else {
          OTHER_FILES += win.cpp
      }
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • M moravas

        Hi Folks,

        My use case is the following:
        I have some classes (source and header) that implement Windows, Linux or MAC dependent part.
        How should I edit my .pro file for exclude the appropriate classes from the build, BUT they stay there in the project side bar for reading or even editing them?
        Can I do this via the .pro file?

        Regards,
        Norbert

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        I scope them as @raven-worx shows for the different platforms, but I don't use OTHER_FILES, they are visible in my Creator (4.2) even if not built.

        Read and abide by the Qt Code of Conduct

        raven-worxR 1 Reply Last reply
        0
        • kshegunovK kshegunov

          I scope them as @raven-worx shows for the different platforms, but I don't use OTHER_FILES, they are visible in my Creator (4.2) even if not built.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @kshegunov
          that was what he requested ... as i understood it?
          If i am wrong, remove the else part.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          kshegunovK 1 Reply Last reply
          0
          • raven-worxR raven-worx

            @kshegunov
            that was what he requested ... as i understood it?
            If i am wrong, remove the else part.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            Yes, I know, I meant that OTHER_FILES += win.cpp shouldn't be needed. At least I don't need it for the files to show in Creator. For example I have:

            macx {
                SOURCES += \
                    $$PWD/qdaemoncontroller_osx.cpp \
                    $$PWD/qdaemon_osx.cpp
            } else: unix {
                SOURCES += \
                    $$PWD/qdaemoncontroller_linux.cpp \
                    $$PWD/qdaemon_linux.cpp
            }
            

            and I see all of them in the sidebar regardless of the platform.

            Read and abide by the Qt Code of Conduct

            raven-worxR 1 Reply Last reply
            2
            • kshegunovK kshegunov

              Yes, I know, I meant that OTHER_FILES += win.cpp shouldn't be needed. At least I don't need it for the files to show in Creator. For example I have:

              macx {
                  SOURCES += \
                      $$PWD/qdaemoncontroller_osx.cpp \
                      $$PWD/qdaemon_osx.cpp
              } else: unix {
                  SOURCES += \
                      $$PWD/qdaemoncontroller_linux.cpp \
                      $$PWD/qdaemon_linux.cpp
              }
              

              and I see all of them in the sidebar regardless of the platform.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @kshegunov
              ah ok, didn't know that.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              kshegunovK 1 Reply Last reply
              0
              • raven-worxR raven-worx

                @kshegunov
                ah ok, didn't know that.

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by kshegunov
                #7

                This might've been a change between Creator versions, that's why I'm raising it as a point (and providing my IDE's version). I think that on older versions this wasn't the case.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  moravas
                  wrote on last edited by
                  #8

                  Hi,

                  It seems to be what I want.
                  Thank you!

                  Regards,
                  Norbert

                  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