This ensures that we only find Qt5 modules from the same directory
as modules we have already found, not from multiple different
directories which may be incompatible.
Change-Id: I7ad1d81ec41bba2e543130740041338ba44a6c3b
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
endif()
foreach(_module ${modules})
if (NOT Qt5${_module}_FOUND)
- message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
+ find_package(Qt5${_module} PATHS ${_qt5_corelib_install_prefix} NO_DEFAULT_PATH)
+ if (NOT Qt5${_module}_FOUND)
+ message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
+ endif()
endif()
target_link_libraries(${_target} ${link_type} ${Qt5${_module}_LIBRARIES})
set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS})
add_executable(two two.cpp)
add_executable(three three.cpp)
-find_package(Qt5Test)
-find_package(Qt5Widgets)
+find_package(Qt5Core)
qt5_use_modules(two Test)
qt5_use_modules(three Widgets Test)