Fix qt_find_package to not show incorrect packages at features summary
qt_find_package usually does 2 find_package() calls, one in CONFIG mode and one in MODULE mode. If the CONFIG mode doesn't find a Config file, the package_DIR cache variable is set to NOTFOUND, and this causes the FeatureSummary at the end to show that the package was not found, even if it is found by the next MODULE mode find_package call. Make sure to unset the _DIR variable in case if the Config module call fails. This fixes XRender showing up as not found even when it's found via the FindXRender.cmake file. Change-Id: I6ce39dad9cbb11836ca71f735a3267070c75b444 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Qt CMake Build Bot
This commit is contained in:
parent
6f5b1dd9ab
commit
34b1c1c23c
@ -2876,6 +2876,13 @@ macro(qt_find_package)
|
||||
endforeach()
|
||||
|
||||
if (NOT ${ARGV0}_FOUND)
|
||||
# Unset the NOTFOUND ${package}_DIR var that might have been set by the previous
|
||||
# find_package call, to get rid of "not found" messagees in the feature summary
|
||||
# if the package is found by the next find_package call.
|
||||
if(DEFINED CACHE{${ARGV0}_DIR} AND NOT ${ARGV0}_DIR)
|
||||
unset(${ARGV0}_DIR CACHE)
|
||||
endif()
|
||||
|
||||
# Call original function without our custom arguments.
|
||||
find_package(${arg_UNPARSED_ARGUMENTS})
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user