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 -> MSVC project: is there a way to disable the /FC flag?
Qt 6.11 is out! See what's new in the release blog

QMake -> MSVC project: is there a way to disable the /FC flag?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
11 Posts 2 Posters 1.4k 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    I'm having the same problem that CMake users had until it was fixed, described and explained here: https://gitlab.kitware.com/cmake/cmake/-/issues/18261

    In short, the /FC flag (use full paths for __FILE__ and similar macros) is the default behavior in MSBuild, so if /FC is NOT set, a line <UseFullPaths>false</UseFullPaths MUST be emitted in the generated project. I assume that because of this inverse logic there is no qmake-native solution (e. g. tricks like QMAKE_CXXFLAGS = $$replace(QMAKE_CXXFLAGS, "/FC ", "") won't work). But there is a potential workaround:

    "Create a ProjectName.vcxproj.user file that turns explicitly sets <UseFullPaths> to false. Because MSBuild merges .user project files with project files of the same name, this lets CMake users disable the setting anyway."

    Can this be done in qmake? More specifically, can this be done once in a .pri file that's included into every .pro for a SUBDIRS project with many libraries?

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

      Hi,

      Wouldn't:

      QMAKE_CXXFLAGS -= /FC
      

      Do the job ?

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

      V 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Wouldn't:

        QMAKE_CXXFLAGS -= /FC
        

        Do the job ?

        V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by
        #3

        @SGaist, no, because qmake is not trying to add this flag - it's not present in QMAKE_CXXFLAGS . But it also doesn't include the following line into the resulting vcxproj, and by default it's true in MSBuild:

        <ClCompile>
              <UseFullPaths>false</UseFullPaths>
        </ClCompile>
        

        So, /FC is on by default and there seems to be no way to turn it off with qmake.

        Since posting the question I have implemented the suggested workaround (creating a .vcxproj.user file), it can be easily done in qmake, but I still can't get it to work - it would appear that MSBuild ignores any <ClCompile> options in a .user file.

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

          Based on the flag documentation I am wondering whether you have also ZI defined which implies FC.

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

          V 1 Reply Last reply
          1
          • SGaistS SGaist

            Based on the flag documentation I am wondering whether you have also ZI defined which implies FC.

            V Offline
            V Offline
            Violet Giraffe
            wrote on last edited by Violet Giraffe
            #5

            @SGaist, I didn't know about this connection, thanks! No, I'm not specifying /Zi in the .pro file, but it is added to the generated project nonetheless. Not sure where it's coming from; QMAKE_CXXFLAGS -= /Zi doesn't affect it. I've also printed QMAKE_CXXFLAGS to make sure it's not there. It must be hard-coded in the vcxproj generator, or in some template file that's part of qmake?

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Violet Giraffe
              wrote on last edited by
              #6

              I have somehow managed to remove /Zi from the generated project, but /FC is still effectively set by virtue of UseFullPaths not being specified in the vcxproj.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Violet Giraffe
                wrote on last edited by Violet Giraffe
                #7

                Not related to the initial question, but here are more examples of thing you can't get right with qmake in a vcxproj:

                1. QMAKE_LFLAGS += /LTCG:INCREMENTAL results in /LTCG being set (the non-incremental option).
                2. QMAKE_LFLAGS += /DEBUG:FULL results in /DEBUG being set (without :FULL). It's probably the same thing, but still annoying.

                What's the status of qmake, is it end of life? I guess these problems won't be fixed if I report them?

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

                  Did you try to quote these expressions ?

                  As for qmake, it shall be supported for the lifetime of Qt 6 so I would say it's worth opening tickets since there are still quite a lot of projects using it.

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

                  V 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Did you try to quote these expressions ?

                    As for qmake, it shall be supported for the lifetime of Qt 6 so I would say it's worth opening tickets since there are still quite a lot of projects using it.

                    V Offline
                    V Offline
                    Violet Giraffe
                    wrote on last edited by Violet Giraffe
                    #9

                    @SGaist, like so? This, unfortunately, changed nothing. And note that things like /OPT:REF and /DEBUG:FASTLINK do work correctly, while /DEBUG:FULL does not.

                    Release:QMAKE_LFLAGS += "/DEBUG:FULL" /OPT:REF /OPT:ICF "/LTCG:INCREMENTAL"
                    

                    In case with DEBUG it's just a nag, but LTCG is a functionality issue of not being able to get the right behavior with qmake.
                    P. S. Thanks for your help and advice!

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

                      Then it is likely an issue with the backend.

                      Don't forget to post a link to your ticket(s) !

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

                      V 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        Then it is likely an issue with the backend.

                        Don't forget to post a link to your ticket(s) !

                        V Offline
                        V Offline
                        Violet Giraffe
                        wrote on last edited by
                        #11

                        Posted an issue: https://bugreports.qt.io/browse/QTBUG-104450

                        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