[solved]In Qt Creator, how to set project property for both MinGW and VC compiler?
-
I know how to use MinGW or Visual C++ compiler for Qt Application on Windows. But I would like some way to auto select the pro setting.
For example:
inside my pro file, I need to set boost lib:
for minGW
LIBS += C:/MinGW/boost_1_46_1/lib/libboost_thread.a
LIBS += C:/MinGW/boost_1_46_1/lib/libboost_date_time.afor VC++
LIBS += C:/VC++/boost_1_46_1/lib/libboost_thread-vc90-mt-1_46_1.lib
LIBS += C:/VC++/boost_1_46_1/lib/libboost_date_time-vc90-mt-1_46_1.libHow to change the pro file so that I do not need manually comment out the LIBS for different compiler?
-
You can use scopes, like
win32-g++ {
LIBS += C:/MinGW/boost_1_46_1/lib/libboost_thread.a
LIBS += C:/MinGW/boost_1_46_1/lib/libboost_date_time.a
}
win32-msvc*{
LIBS = C:/VC+/boost_1_46_1/lib/libboost_thread-vc90-mt-1_46_1.lib
LIBS = C:/VC+/boost_1_46_1/lib/libboost_date_time-vc90-mt-1_46_1.lib
} -
I actually hate to hardcode pathes like those into the build system: This will break as soon as you hand it over to somebody else!
Maybe you could use environment variables or something instead. Those are a bit easier to change and document (set BLAH to "/some/path" instead of edit "blah.pro", search for the line reading LIBS += "/some/path" and replace it with the path you need.
Unfortunately qmake does not support proper configuration steps to do the whole configuration properly.
-
Maybe we can write like this:
@
OPENCVPATH_MSVC = D:/Qt/OpenCV-2.1.0-vs2008
OPENCVPATH_MINGW = D:/Qt/OpenCV-2.1.0-mingwwin32-msvc*{
INCLUDEPATH += $${OPENCVPATH_MSVC}/include
CONFIG(debug, debug|release) {
LIBS+=-L$${OPENCVPATH_MSVC}/lib/
-lcxcore210d
-lhighgui210d
} else {
LIBS += -L$${OPENCVPATH_MSVC}/lib/
-lcxcore210
-lhighgui210
}
}win32-g++{
INCLUDEPATH += $${OPENCVPATH_MINGW}/include
LIBS += -L$${OPENCVPATH_MINGW}/lib
-lcxcore210
-lhighgui210
}unix:LIBS += -lcv
-lhighgui
@