diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-09-27 13:29:47 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-09-27 14:28:04 +0000 |
commit | 34b1c1c23cbddf67f878579bee9d10dcac29d8ca (patch) | |
tree | 91f699eb538f985ec06b9aa50e3fc7687d4eb7a6 /cmake/QtBuild.cmake | |
parent | 6f5b1dd9ab257542c9f1d0be324968a487e9a77b (diff) |
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
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index f02553e8ea..5f64803508 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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() |