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. Detecting compiler if VS2010 or MinGW compiler is used.
Qt 6.11 is out! See what's new in the release blog

Detecting compiler if VS2010 or MinGW compiler is used.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k 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.
  • S Offline
    S Offline
    StoneByte
    wrote on last edited by
    #1

    Is there a way to detect in the .pro file which compiler is being used?
    The MinGW compiler creates libABC.a files but VS2010 creates ABC.lib.
    I want to support them both so i need i need a LIBS statement for MinGW and one for VS2010.
    Alternative is to force VS2010 to generate libABC.a, but if i set this to the TARGET is creates a libABC.a.lib !!

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

      Hi and welcome to devnet,

      Unless you are providing the full path to the library file when linking you don't need to do that.

      @LIBS += -LC:/Path/To/lib_ABC_lib_file/ -lABC@

      should be enough

      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
      0
      • S Offline
        S Offline
        StoneByte
        wrote on last edited by
        #3

        Thnx, that works. But how about the libraries listed in the PRE_TARGETDEPS?

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

          You can use scopes:

          @
          mingw {
          PRE_TARGETDEPS += /path/to/my_lib/libABC.a
          } else {
          PRE_TARGETDEPS += /path/to/my_lib/ABC.lib
          }
          @

          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
          0

          • Login

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