From 8d0ce19ca6cef467e67a49cb720fa5ed61aaca35 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Fri, 12 Jan 2018 14:49:58 +0100 Subject: Fix cmake scope for locally installed modules If modules are installed on the system but not in the local Qt installation, cmake will find them and try to build, but this will lead to errors. Comparing the QT_INCLUDE_DIR and the path where the package was found, we can filter the modules that were found on a different directory. Change-Id: I463172b7081c191fb303387f98a495dd675e0486 Reviewed-by: Friedemann Kleint Reviewed-by: Alexandru Croitor --- sources/pyside2/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sources/pyside2/CMakeLists.txt') diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 6a8c612f3..bfd8eb5be 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -227,6 +227,9 @@ macro(COLLECT_MODULE_IF_FOUND shortname) set(name "Qt5${shortname}") find_package(${name}) set(_name_found "${name}_FOUND") + set(_name_dir "${name}_DIR") + get_filename_component(_qt_dir ${QT_INCLUDE_DIR} DIRECTORY) + get_filename_component(_module_dir "${${_name_dir}}/../../../" ABSOLUTE) # Determine essential/optional/missing set(module_state "missing") @@ -240,7 +243,7 @@ macro(COLLECT_MODULE_IF_FOUND shortname) set(module_state "essential") endif() - if(${_name_found}) + if(${${_name_found}} AND ${_qt_dir} STREQUAL ${_module_dir}) message(STATUS "${module_state} module ${name} found (${ARGN})") # record the shortnames for the tests list(APPEND all_module_shortnames ${shortname}) -- cgit v1.2.3