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. [SOLVED]QMake,how to achieve kit detection and automatic conditional linking.
QtWS25 Last Chance

[SOLVED]QMake,how to achieve kit detection and automatic conditional linking.

Scheduled Pinned Locked Moved General and Desktop
qmakekitlinker
3 Posts 2 Posters 3.5k 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.
  • M Offline
    M Offline
    musimbate
    wrote on 5 Apr 2015, 04:16 last edited by musimbate 4 May 2015, 08:16
    #1

    Hi,
    I have a project that I am building for msvc,mingw and android ,in my project file I have something like this :

    #msvc
    #LIBS += E:\project\libs\msvc\lib0.lib
    
    #Android
    LIBS += E:\project\libs\android\lib.a
    
    #Mingw
    #LIBS += E:\project\libs\mingw\lib.a
    

    I want to do something like:

    if(using msvc kit)
    LIBS += E:\project\libs\msvc\lib.lib
    
    if(using android kit)
    LIBS += E:\project\libs\android\lib.a
    
    if(using mingw kit)
    LIBS += E:\project\libs\mingw\lib.a
    

    To achieve automatic linking when I switch kits without me going back to comment and uncomment things.Is there a way I can do that in QMake?

    Thank you for your time.

    Why join the navy if you can be a pirate?-Steve Jobs

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 5 Apr 2015, 07:52 last edited by
      #2

      Use the mkspec name of the kit you're using to conditionally define LIBS, e.g. :

      win32-msvc* {
          LIBS += E:\project\libs\msvc\lib.lib
      }
      android-g++ {
          LIBS += E:\project\libs\android\lib.a
      }
      win32-g++ {
          LIBS += E:\project\libs\mingw\lib.a
      }
      

      The complete list of possibilities is in the mkspecs directory of Qt installation.

      M 1 Reply Last reply 5 Apr 2015, 08:16
      1
      • C Chris Kawa
        5 Apr 2015, 07:52

        Use the mkspec name of the kit you're using to conditionally define LIBS, e.g. :

        win32-msvc* {
            LIBS += E:\project\libs\msvc\lib.lib
        }
        android-g++ {
            LIBS += E:\project\libs\android\lib.a
        }
        win32-g++ {
            LIBS += E:\project\libs\mingw\lib.a
        }
        

        The complete list of possibilities is in the mkspecs directory of Qt installation.

        M Offline
        M Offline
        musimbate
        wrote on 5 Apr 2015, 08:16 last edited by
        #3

        @Chris-Kawa

        Thanks ,works like a charm.

        Why join the navy if you can be a pirate?-Steve Jobs

        1 Reply Last reply
        0

        3/3

        5 Apr 2015, 08:16

        • Login

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