I know how to specify boost libraries in .pro file. But if I want to build a project after switching to another compiler, I need to change the path. I want proper boost library to be selected when I switch kit in Qt creator.
3
votes
1 Answers
1
votes
One method is to use an environment variable for the location of the boost library, e.g. BOOST_ROOT
and then read it in the .pro file:
# Ensure that the BOOST_ROOT environment variable has been set
BOOST_ROOT = $$(BOOST_ROOT)
isEmpty(BOOST_ROOT) {
error("Please set BOOST_ROOT to the location of the Boost libraries")
} else {
message(Using Boost from: $$BOOST_ROOT)
}
INCLUDEPATH += $$BOOST_ROOT
LIBS += -L$${BOOST_ROOT}/stage/lib
When you switch compiler kits you can change the environment variable under Projects->Build Environment
. QtCreator will store the change to the environment variable for the compiler kit build.
So be sure to change the environment variable for both the debug
and release
builds for each compiler kit.