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. qmake: How to set a variable that must contain spaces?
Forum Updated to NodeBB v4.3 + New Features

qmake: How to set a variable that must contain spaces?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 3 Posters 2.9k 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on 15 Dec 2017, 15:21 last edited by
    #1

    I need to set QMAKE_CXXFLAGS to a value that contains spaces, specifically

    QMAKE_CXXFLAGS += /AI"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0"
    

    The PROGRAMFILES environment variable will (usually) resolve to a path with spaces. How can I handle that?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 Dec 2017, 15:45 last edited by
      #2

      Hi,

      You can try shell_path or maybe shell_quote.

      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

      A 1 Reply Last reply 15 Dec 2017, 16:05
      0
      • S SGaist
        15 Dec 2017, 15:45

        Hi,

        You can try shell_path or maybe shell_quote.

        Hope it helps

        A Offline
        A Offline
        Asperamanca
        wrote on 15 Dec 2017, 16:05 last edited by
        #3

        @SGaist
        Forgot to mention I'm still sitting on 4.8...

        A 1 Reply Last reply 16 Dec 2017, 09:00
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Dec 2017, 20:37 last edited by
          #4

          In that case, did you try with just quote ?

          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
          1
          • A Asperamanca
            15 Dec 2017, 16:05

            @SGaist
            Forgot to mention I'm still sitting on 4.8...

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 16 Dec 2017, 09:00 last edited by aha_1980
            #5

            @Asperamanca

            Without the possibility to test, I think you have to escape the quotes with enough escape chars ('') so the quotes actually get to the shell. You may need two or three pairs of '' to get it work - just test until it works :)

            QMAKE_CXXFLAGS += /AI"\\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\\""
            

            Edit: seems my escape chars were lost, I meant backslashes '\'

            Qt has to stay free or it will die.

            A 1 Reply Last reply 18 Dec 2017, 08:03
            3
            • A aha_1980
              16 Dec 2017, 09:00

              @Asperamanca

              Without the possibility to test, I think you have to escape the quotes with enough escape chars ('') so the quotes actually get to the shell. You may need two or three pairs of '' to get it work - just test until it works :)

              QMAKE_CXXFLAGS += /AI"\\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\\""
              

              Edit: seems my escape chars were lost, I meant backslashes '\'

              A Offline
              A Offline
              Asperamanca
              wrote on 18 Dec 2017, 08:03 last edited by
              #6

              @aha_1980
              That put me on the right track. The solution is:

              QMAKE_CXXFLAGS += /AI\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\"
              

              Thanks!

              A 1 Reply Last reply 18 Dec 2017, 20:12
              1
              • A Asperamanca
                18 Dec 2017, 08:03

                @aha_1980
                That put me on the right track. The solution is:

                QMAKE_CXXFLAGS += /AI\"$$(PROGRAMFILES)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0\"
                

                Thanks!

                A Offline
                A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 18 Dec 2017, 20:12 last edited by
                #7

                @Asperamanca Cool! Thanks for reporting back.

                Please mark this thread as solved now.

                Qt has to stay free or it will die.

                1 Reply Last reply
                0

                6/7

                18 Dec 2017, 08:03

                • Login

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