If the libraries you're trying to link to do not have pkgconfig information, you can make a qmake config test for each of these libraries using qtCompileTest()
. I'll show you here how to use this feature of qmake.
qtCompileTest qmake config tests will run at qmake time. If the test compiles, config_ will be added to the CONFIG variable and qmake will print Checking for <testname>... yes
or Checking for <testname>... no
depending on whether or not the test compiled.
In your project dir, create a directory with the name config_tests, and under that create a directory for the library or feature you're going to test, a starting simple qmake project and main.cpp file, ending up like so:
myproject/
myproject.pro
<source files, etc>
config_tests/
googletest/
googletest.pro
main.cpp
Make the googletest project be very simple, with just the bare minimum to link an executable to the googletest library, and test including necessary headers for using it. Load this project directly into Qt Creator and test that it actually compiles in the scenarios you expect it to work, and not in others (i.e. test for the various platforms you'll be using that contain and don't contain the googletest library)
Next, use this qmake config test project in your main project by adding the following to the top of your project. load(configure)
below loads in the qmake support for qtCompileTest - as it's not normally built-in:
load(configure)
qtCompileTest(googletest)
In the places where you will be compiling features that require googletest, you can wrap them in the following qmake test:
CONFIG(config_googletest) {
}