diff --git a/cmake/modules/FindQt5PlatformSupport.cmake b/cmake/modules/FindQt5PlatformSupport.cmake --- a/cmake/modules/FindQt5PlatformSupport.cmake +++ b/cmake/modules/FindQt5PlatformSupport.cmake @@ -64,20 +64,35 @@ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindQt5PlatformSupport.cmake") endif() -# Use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -find_package(PkgConfig) -pkg_check_modules(PKG_Qt5PlatformSupport QUIET Qt5Gui) - -set(Qt5PlatformSupport_DEFINITIONS ${PKG_Qt5PlatformSupport_CFLAGS_OTHER}) -set(Qt5PlatformSupport_VERSION ${PKG_Qt5PlatformSupport_VERSION}) - +#Trying to find in the default paths +if (NOT ${Qt5Core_VERSION}) + find_package(Qt5Core) +endif() find_path(Qt5PlatformSupport_INCLUDE_DIR NAMES QtPlatformSupport/private/qfontconfigdatabase_p.h - HINTS - ${PKG_Qt5PlatformSupport_INCLUDEDIR}/QtPlatformSupport/${PKG_Qt5PlatformSupport_VERSION}/ + PATH_SUFFIXES + QtPlatformSupport/${Qt5Core_VERSION}/ ) + +if (Qt5PlatformSupport_INCLUDE_DIR) + set(Qt5PlatformSupport_VERSION ${Qt5Core_VERSION}) +else() + # Use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PKG_Qt5PlatformSupport QUIET Qt5Gui) + + set(Qt5PlatformSupport_DEFINITIONS ${PKG_Qt5PlatformSupport_CFLAGS_OTHER}) + set(Qt5PlatformSupport_VERSION ${PKG_Qt5PlatformSupport_VERSION}) + find_path(Qt5PlatformSupport_INCLUDE_DIR + NAMES + QtPlatformSupport/private/qfontconfigdatabase_p.h + HINTS + ${PKG_Qt5PlatformSupport_INCLUDEDIR}/QtPlatformSupport/${PKG_Qt5PlatformSupport_VERSION}/ + ) +endif() + find_library(Qt5PlatformSupport_LIBRARY NAMES Qt5PlatformSupport diff --git a/cmake/modules/FindQt5ThemeSupport.cmake b/cmake/modules/FindQt5ThemeSupport.cmake --- a/cmake/modules/FindQt5ThemeSupport.cmake +++ b/cmake/modules/FindQt5ThemeSupport.cmake @@ -65,20 +65,35 @@ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindQt5ThemeSupport.cmake") endif() -# Use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -find_package(PkgConfig) -pkg_check_modules(PKG_Qt5ThemeSupport QUIET Qt5Gui) - -set(Qt5ThemeSupport_DEFINITIONS ${PKG_Qt5ThemeSupport_CFLAGS_OTHER}) -set(Qt5ThemeSupport_VERSION ${PKG_Qt5ThemeSupport_VERSION}) - +#Trying to find in the default paths +if (NOT ${Qt5Core_VERSION}) + find_package(Qt5Core) +endif() find_path(Qt5ThemeSupport_INCLUDE_DIR NAMES QtThemeSupport/private/qgenericunixthemes_p.h - HINTS - ${PKG_Qt5ThemeSupport_INCLUDEDIR}/QtThemeSupport/${PKG_Qt5ThemeSupport_VERSION}/ + PATH_SUFFIXES + QtThemeSupport/${Qt5Core_VERSION}/ ) + +if (Qt5ThemeSupport_INCLUDE_DIR) + set(Qt5ThemeSupport_VERSION ${Qt5Core_VERSION}) +else() + # Use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PKG_Qt5ThemeSupport QUIET Qt5Gui) + + set(Qt5ThemeSupport_DEFINITIONS ${PKG_Qt5ThemeSupport_CFLAGS_OTHER}) + set(Qt5ThemeSupport_VERSION ${PKG_Qt5ThemeSupport_VERSION}) + find_path(Qt5ThemeSupport_INCLUDE_DIR + NAMES + QtThemeSupport/private/qgenericunixthemes_p.h + HINTS + ${PKG_Qt5ThemeSupport_INCLUDEDIR}/QtThemeSupport/${PKG_Qt5ThemeSupport_VERSION}/ + ) +endif() + find_library(Qt5ThemeSupport_LIBRARY NAMES Qt5ThemeSupport