Search code examples
c++qtqt4qmakegoogletest

qmake checking for library


I have a qt project setup as a subdirs project with my source code in a src directory and unit testing code setup in a test directory. Each has its own project file. I want to be able to compile the source on other computers, but they may not have the googletest library setup. I have looked at the qmake test function "requires()" and "packagesExist()" however, they do not seem to be built to handle external libraries.

How can I instruct qmake to skip the test project if the testing library is not found?


Solution

  • It is not possible without checking typical locations if the library is present in there.

    Unfortunately, googletest does not seem to ship package-config ".pc" files either, so that is why you cannot use the packagesExist() qmake function.

    So, I would use a bunch of exist call to work this around, or switch away from qmake to something better like cmake.

    !exists("/foo/bar/baz.so"):!exists("/hello/world/baz.so"):...: message("Google test is not installed on your system")