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. GLOB or regex in source
Forum Updated to NodeBB v4.3 + New Features

GLOB or regex in source

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 2.0k 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.
  • D Offline
    D Offline
    danyal
    wrote on last edited by
    #1

    I would like to add all the files from the directory. I did it this way.
    SOURCES += ./source/*
    I also tried so source/* , source*, .\source*
    But this does not work, an error occurs

    $ qmake.exe ..
    WARNING: Failure to find: source\*
    WARNING: Failure to find: source\*

    What am I doing wrong?

    aha_1980A 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Normally its

      SOURCES += *.cpp
      HEADERS += *.h
      
      so maybe
      
      SOURCES += source/*.cpp
      HEADERS += source/*.h
      

      Update: Nope. This works.

      SOURCES += $$PWD$$/source/*.cpp
      HEADERS += $$PWD$$/source/*.h
      
      

      Note that it will complain if it dont find at least one cpp and .h

      D 1 Reply Last reply
      2
      • D danyal

        I would like to add all the files from the directory. I did it this way.
        SOURCES += ./source/*
        I also tried so source/* , source*, .\source*
        But this does not work, an error occurs

        $ qmake.exe ..
        WARNING: Failure to find: source\*
        WARNING: Failure to find: source\*

        What am I doing wrong?

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @danyal said in GLOB or regex in source:

        $ qmake.exe ..

        Are you calling qmake from a subdir? What happens if you call it from the directory the .pro file is in?

        Qt has to stay free or it will die.

        D 1 Reply Last reply
        1
        • mrjjM mrjj

          Hi
          Normally its

          SOURCES += *.cpp
          HEADERS += *.h
          
          so maybe
          
          SOURCES += source/*.cpp
          HEADERS += source/*.h
          

          Update: Nope. This works.

          SOURCES += $$PWD$$/source/*.cpp
          HEADERS += $$PWD$$/source/*.h
          
          

          Note that it will complain if it dont find at least one cpp and .h

          D Offline
          D Offline
          danyal
          wrote on last edited by danyal
          #4

          @mrjj SOURCES += source/*.cpp does not work

          WARNING: Failure to find: source*.cpp
          WARNING: Failure to find: source*.cpp

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

            Hi
            Just tested

            SOURCES += $$PWD$$/source/*.cpp
            HEADERS += $$PWD$$/source/*.h
            
            

            and files was found and included.
            Note that it will complain if it dont find at least one cpp and 1 .h
            Also this assumes that source is a subfolder to the folder where .pro is.

            D 1 Reply Last reply
            2
            • mrjjM mrjj

              Hi
              Just tested

              SOURCES += $$PWD$$/source/*.cpp
              HEADERS += $$PWD$$/source/*.h
              
              

              and files was found and included.
              Note that it will complain if it dont find at least one cpp and 1 .h
              Also this assumes that source is a subfolder to the folder where .pro is.

              D Offline
              D Offline
              danyal
              wrote on last edited by
              #6

              @mrjj it is work . thanks

              aha_1980A 1 Reply Last reply
              1
              • D danyal

                @mrjj it is work . thanks

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @danyal Then please mark this thread as SOLVED.

                Qt has to stay free or it will die.

                1 Reply Last reply
                2
                • aha_1980A aha_1980

                  @danyal said in GLOB or regex in source:

                  $ qmake.exe ..

                  Are you calling qmake from a subdir? What happens if you call it from the directory the .pro file is in?

                  D Offline
                  D Offline
                  danyal
                  wrote on last edited by
                  #8

                  @aha_1980 Yes you are right. So it works too

                  aha_1980A 1 Reply Last reply
                  0
                  • D danyal

                    @aha_1980 Yes you are right. So it works too

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @danyal

                    But @mrjj's solution is better, as it also works for shadow-builds.

                    Qt has to stay free or it will die.

                    D 1 Reply Last reply
                    0
                    • aha_1980A aha_1980

                      @danyal

                      But @mrjj's solution is better, as it also works for shadow-builds.

                      D Offline
                      D Offline
                      danyal
                      wrote on last edited by
                      #10

                      @aha_1980 How can i do this?

                      aha_1980A 1 Reply Last reply
                      0
                      • D danyal

                        @aha_1980 How can i do this?

                        aha_1980A Offline
                        aha_1980A Offline
                        aha_1980
                        Lifetime Qt Champion
                        wrote on last edited by aha_1980
                        #11

                        @danyal You should have a button "thread tools" and there "mark as solved".

                        Cannot exactly tell you as I don't have one for your thread.

                        Edit: Ah, it's topic, not thread. Thanks @mrjj

                        Qt has to stay free or it will die.

                        1 Reply Last reply
                        1
                        • mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          alt text

                          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