Add support for locating headers and libs in qt_configure

So far we only had support for locating executables. Also
support locating header files and libraries.

Change-Id: Ib2a83e8338d2da975204089d84c608061a081f29
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Lars Knoll 2016-08-05 17:54:26 +02:00 committed by Oswald Buddenhagen
parent c8b46d3989
commit 27b03be893

View File

@ -275,15 +275,19 @@ defineTest(qtConfTest_linkerSupportsFlag) {
return($$qtConfToolchainSupportsFlag($$LFLAGS "-Wl,$$flag"))
}
defineReplace(qtConfFindInPath) {
ensurePathEnv()
for (dir, QMAKE_PATH_ENV) {
defineReplace(qtConfFindInPathList) {
for (dir, 2) {
exists("$$dir/$${1}"): \
return("$$dir/$${1}")
}
return()
}
defineReplace(qtConfFindInPath) {
ensurePathEnv()
return($$qtConfFindInPathList($$1, $$QMAKE_PATH_ENV))
}
defineReplace(qtConfPkgConfigEnv) {
env =
!isEmpty(PKG_CONFIG_SYSROOT_DIR): env = "$${SETENV_PFX}PKG_CONFIG_SYSROOT_DIR=$${PKG_CONFIG_SYSROOT_DIR}$${SETENV_SFX} "
@ -607,6 +611,27 @@ defineTest(qtConfTest_compile) {
return(false)
}
defineTest(qtConfTest_files) {
for(i, $${1}.files._KEYS_) {
f = $$eval($${1}.files.$${i})
qtLog("Searching for file $${f}.")
contains(f, ".*\.h") {
file = $$qtConfFindInPathList($$f, $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS)
} else: contains(f, ".*\.(lib|so|a)") {
file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS)
} else {
# assume we're looking for an executable
file = $$qtConfFindInPath($$f)
}
isEmpty(file) {
qtLog(" Not found.");
return(false)
}
qtLog(" Found at $${file}.")
}
return(true)
}
defineTest(logn) {
log("$${1}$$escape_expand(\\n)")
}