diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-01-25 10:17:07 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-02-01 06:47:58 +0000 |
commit | cc9950a7dc15c533529b34f1b6b9737c7c19fec0 (patch) | |
tree | 789dedcd11c522763aa790cec1a2fa32b292ea54 /sources/pyside2/CMakeLists.txt | |
parent | 819f7b47b1fcdc2ed88bdd07383bbd37a76848ac (diff) |
Fix CMake for local system installations
Amends 8d0ce19ca6cef467e67a49cb720fa5ed61aaca35
Task-number: PYSIDE-596
Change-Id: I4acd653d0772ddee85a06f41b5273018c3861651
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/CMakeLists.txt')
-rw-r--r-- | sources/pyside2/CMakeLists.txt | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 8dc1816f0..666ee3681 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -226,10 +226,28 @@ include(PySideModules) macro(COLLECT_MODULE_IF_FOUND shortname) set(name "Qt5${shortname}") find_package(${name}) + # If package is found, _name_found will be equal to 1 set(_name_found "${name}_FOUND") + # _name_dir will keep the path to the directory where the CMake rules were found + # e.g: ~/qt5.9-install/qtbase/lib/cmake/Qt5Core or /usr/lib64/cmake/Qt5Core set(_name_dir "${name}_DIR") - get_filename_component(_qt_dir ${QT_INCLUDE_DIR} DIRECTORY) - get_filename_component(_module_dir "${${_name_dir}}/../../../" ABSOLUTE) + # Qt5Core will set the base path to check if all the modules are on the same + # directory, to avoid CMake looking in another path. + # This will be saved in a global variable at the beginning of the modules + # collection process. + string(FIND "${name}" "Qt5Core" qtcore_found) + if(("${qtcore_found}" GREATER "0") OR ("${qtcore_found}" EQUAL "0")) + get_filename_component(_core_abs_dir "${${_name_dir}}/../" ABSOLUTE) + # Setting the absolute path where the Qt5Core was found + # e.g: ~/qt5.9-install/qtbase/lib/cmake or /usr/lib64/cmake + message(STATUS "CORE_ABS_DIR:" ${_core_abs_dir}) + endif() + + # Getting the absolute path for each module where the CMake was found, to + # compare it with CORE_ABS_DIR and check if they are in the same source directory + # e.g: ~/qt5.9-install/qtbase/lib/cmake/Qt5Script or /usr/lib64/cmake/Qt5Script + get_filename_component(_module_dir "${${_name_dir}}" ABSOLUTE) + string(FIND "${_module_dir}" "${_core_abs_dir}" found_basepath) # Determine essential/optional/missing set(module_state "missing") @@ -243,7 +261,9 @@ macro(COLLECT_MODULE_IF_FOUND shortname) set(module_state "essential") endif() - if(${${_name_found}} AND ${_qt_dir} STREQUAL ${_module_dir}) + # If the module was found, and also the module path is the same as the + # Qt5Core base path, we will generate the list with the modules to be install + if("${${_name_found}}" AND (("${found_basepath}" GREATER "0") OR ("${found_basepath}" EQUAL "0"))) message(STATUS "${module_state} module ${name} found (${ARGN})") # record the shortnames for the tests list(APPEND all_module_shortnames ${shortname}) |