[CMake] Use imported executable targets for finding Qt uic/rcc
Commit ad7077c03daf ("Update FindPySide2Tools.cmake") removed the
versioned names of uic/rcc, which are at least used on openSUSE
and Fedora.
Instead of determining the path of uic/rcc manually, just use
the imported executable targets. rcc comes from QtCore, while
uic comes from QtWidgets.
Fixes #6445.
This commit is contained in:
@@ -23,7 +23,7 @@ endif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# Since Qt v5.14, pyside2-uic and pyside2-rcc are directly provided by Qt5Core uic and rcc, with '-g python' option
|
||||
# We test Qt5Core version to act accordingly
|
||||
|
||||
FIND_PACKAGE(Qt5Core)
|
||||
FIND_PACKAGE(Qt5 COMPONENTS Core Widgets)
|
||||
|
||||
IF(Qt5Core_VERSION VERSION_LESS 5.14)
|
||||
# Legacy (< 5.14)
|
||||
@@ -33,10 +33,14 @@ IF(Qt5Core_VERSION VERSION_LESS 5.14)
|
||||
set(RCCOPTIONS "")
|
||||
ELSE()
|
||||
# New (>= 5.14)
|
||||
FIND_PROGRAM(PYSIDE2UICBINARY NAMES uic )#pyside2-uic)
|
||||
set(UICOPTIONS "--generator=python")
|
||||
FIND_PROGRAM(PYSIDE2RCCBINARY NAMES rcc )#pyside2-rcc)
|
||||
set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1")
|
||||
if (TARGET Qt::uic)
|
||||
get_property(PYSIDE2UICBINARY TARGET Qt::uic PROPERTY LOCATION)
|
||||
set(UICOPTIONS "--generator=python")
|
||||
endif()
|
||||
if (TARGET Qt::rcc)
|
||||
get_property(PYSIDE2RCCBINARY TARGET Qt::rcc PROPERTY LOCATION)
|
||||
set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1")
|
||||
endif()
|
||||
ENDIF(Qt5Core_VERSION VERSION_LESS 5.14)
|
||||
|
||||
MACRO(PYSIDE_WRAP_UI outfiles)
|
||||
@@ -93,11 +97,8 @@ MACRO(PYSIDE_WRAP_RC outfiles)
|
||||
ENDFOREACH(it)
|
||||
ENDMACRO (PYSIDE_WRAP_RC)
|
||||
|
||||
IF(EXISTS ${PYSIDE2UICBINARY} AND EXISTS ${PYSIDE2RCCBINARY})
|
||||
set(PYSIDE2_TOOLS_FOUND TRUE)
|
||||
ENDIF(EXISTS ${PYSIDE2UICBINARY} AND EXISTS ${PYSIDE2RCCBINARY})
|
||||
|
||||
if(PYSIDE2RCCBINARY AND PYSIDE2UICBINARY)
|
||||
set(PYSIDE2_TOOLS_FOUND TRUE)
|
||||
if (NOT PySide2Tools_FIND_QUIETLY)
|
||||
message(STATUS "Found PySide2 tools: ${PYSIDE2UICBINARY}, ${PYSIDE2RCCBINARY}")
|
||||
endif (NOT PySide2Tools_FIND_QUIETLY)
|
||||
|
||||
Reference in New Issue
Block a user