coyotte508
coyotte508

Reputation: 9705

How to know in a Qt .pro file if visual studio is the compiler?

Is there a way to know if Visual Studio is the compiler in a .pro file?

For example there are a lot of ways to detect things in the project file including OS or configuration:

CONFIG(boost_asio) {
    DEFINES += BOOST_SOCKETS
    SOURCES += asiosocket.cpp
    LIBS += -L/usr/local/lib \
        -lboost_system
}

OTHER_FILES += 

contains(QT_VERSION, ^5\\.[0-9]\\..*) {
  SOURCES += wavreader.cpp
  HEADERS += wavreader.h
  QT += multimedia
}

include(../../Shared/Common.pri)

windows: { LIBS += -L$$bin -lzip-2 }
!windows: { LIBS += -lzip }

What I want is to provide a proper linking to boost libraries on both mingw and boost. But they have names like boost_chrono-vc120-mt-1_58 which are dependent on the compiler.

Is there any way I can have something like:

visualstudio {
   LIBS += -LC:/boost/libs -lboost_system-vc120-mt-1_58
}

One way would be to have the user tell which compiler he's using in the CONFIG argument of qmake, but I don't think that's the best solution.

Upvotes: 0

Views: 2711

Answers (1)

Todd Christensen
Todd Christensen

Reputation: 1327

Rather than Visual Studio, you want to check if MSVC is being used. See here:

Qt .pro file: how to check if I'm compiling with MSVC 2013 toolset?

qmake: Test for current spec

Upvotes: 2

Related Questions