From 153154f484ab1c3e6196dc02d62f2094fff40e97 Mon Sep 17 00:00:00 2001 From: xiphon Date: Wed, 28 Oct 2020 00:54:32 +0000 Subject: [PATCH] cmake: Linux - Qt 5.15 installer support --- CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2c2535d..267cdcda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,12 +218,14 @@ endif() if(APPLE) list(APPEND QT5_LIBRARIES Qt5MacExtras) +endif() +if(UNIX) if(NOT CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH}) message(STATUS "Using CMAKE_PREFIX_PATH environment variable: '$ENV{CMAKE_PREFIX_PATH}'") set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) endif() - if(NOT CMAKE_PREFIX_PATH) + if(APPLE AND NOT CMAKE_PREFIX_PATH) execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR}) endif() @@ -261,15 +263,12 @@ if(QT5_PKG_CONFIG_FOUND) set(QT5_PKG_CONFIG "${QT5_PKG_CONFIG}_STATIC") endif() - if(APPLE) - list(JOIN ${QT5_PKG_CONFIG}_LDFLAGS_OTHER " " ${QT5_PKG_CONFIG}_LDFLAGS_OTHER) - list(JOIN ${QT5_PKG_CONFIG}_LIBRARIES " " ${QT5_PKG_CONFIG}_LIBRARIES) - list(JOIN ${QT5_PKG_CONFIG}_INCLUDE_DIRS " " ${QT5_PKG_CONFIG}_INCLUDE_DIRS) - + if(UNIX) # temporal workaround for https://bugreports.qt.io/browse/QTBUG-80922 STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${CMAKE_PREFIX_PATH}" ${QT5_PKG_CONFIG}_LDFLAGS_OTHER "${${QT5_PKG_CONFIG}_LDFLAGS_OTHER}") STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${CMAKE_PREFIX_PATH}" ${QT5_PKG_CONFIG}_LIBRARIES "${${QT5_PKG_CONFIG}_LIBRARIES}") STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${CMAKE_PREFIX_PATH}" ${QT5_PKG_CONFIG}_INCLUDE_DIRS "${${QT5_PKG_CONFIG}_INCLUDE_DIRS}") + STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${CMAKE_PREFIX_PATH}" ${QT5_PKG_CONFIG}_LIBRARY_DIRS "${${QT5_PKG_CONFIG}_LIBRARY_DIRS}") endif() set(QT5_LIBRARIES ${${QT5_PKG_CONFIG}_LIBRARIES} ${${QT5_PKG_CONFIG}_LDFLAGS_OTHER})