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. how to add line break in qmake function
Forum Updated to NodeBB v4.3 + New Features

how to add line break in qmake function

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 802 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.
  • S Offline
    S Offline
    spobit
    wrote on 19 Oct 2019, 23:26 last edited by spobit
    #1

    Hi, everyone.

    I'm busy recently, so that no time to login the forum. my god.

    I have a problem about line break in qmake function, because of the error for command too long.

    The function:

    defineTest(CopyFiles){
            src_dir = $$1 #first argument
            dst_dir = $$2 #second argument
    win32:{
                for(name,src_dir){
                    cmd +=  xcopy $$name $$dst_dir\ /y /c &&
                    curFile =$$name
                }
                cmd +=  xcopy $$curFile $$dst_dir\ /y /c
           }
    }
    

    The result of cmd is in one line, it causes the error of command to long. so, I needs insert line break. how to do, thanks.

    A 1 Reply Last reply 20 Oct 2019, 05:16
    0
    • S spobit
      19 Oct 2019, 23:26

      Hi, everyone.

      I'm busy recently, so that no time to login the forum. my god.

      I have a problem about line break in qmake function, because of the error for command too long.

      The function:

      defineTest(CopyFiles){
              src_dir = $$1 #first argument
              dst_dir = $$2 #second argument
      win32:{
                  for(name,src_dir){
                      cmd +=  xcopy $$name $$dst_dir\ /y /c &&
                      curFile =$$name
                  }
                  cmd +=  xcopy $$curFile $$dst_dir\ /y /c
             }
      }
      

      The result of cmd is in one line, it causes the error of command to long. so, I needs insert line break. how to do, thanks.

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 20 Oct 2019, 05:16 last edited by
      #2

      Hi @spobit,

      maybe you can explain what you really want to do? Why do you put all these xcopy commands in one variable?

      You could run xcopy directly in the for loop, but even better would be to use xcopy's possibility to copy a whole directory: xcopy $$src_dir $$dst_dir\ /y /c

      Regards

      Qt has to stay free or it will die.

      S 1 Reply Last reply 6 Nov 2019, 05:09
      2
      • A aha_1980
        20 Oct 2019, 05:16

        Hi @spobit,

        maybe you can explain what you really want to do? Why do you put all these xcopy commands in one variable?

        You could run xcopy directly in the for loop, but even better would be to use xcopy's possibility to copy a whole directory: xcopy $$src_dir $$dst_dir\ /y /c

        Regards

        S Offline
        S Offline
        spobit
        wrote on 6 Nov 2019, 05:09 last edited by
        #3

        @aha_1980 Thank you very much, first. I got a way by my team:

            for(file, src_files) {
                # replace slashes in source path for Windows
                win32:file ~= s,/,\\,g
                QMAKE_PRE_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dst_dir) $$escape_expand(\\n\\t)
            }
        
        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