Files
create/cMake/FindPySide6.cmake
2025-02-22 20:48:44 -06:00

27 lines
1.1 KiB
CMake

# The Qt for Python project officially recommends using pip to install PySide, so we expect to find PySide in the
# site-packages directory. The library will be called "PySide6.abi3.*", and there will be an "include" directory inside
# the site-packages/PySide6. Over time some distros may provide custom versions, so we also support using a more normal
# cMake find_package() call
find_package(PySide6 CONFIG QUIET)
if(NOT PySide6_FOUND)
if(NOT PySide6_INCLUDE_DIRS AND TARGET PySide6::pyside6)
get_property(PySide6_INCLUDE_DIRS TARGET PySide6::pyside6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(NOT PySide6_INCLUDE_DIRS)
find_pip_package(PySide6)
else()
set(PySide6_FOUND ON CACHE BOOL OFF)
endif()
endif()
# Also provide the old-style variables so we don't have to update everything yet
if (PySide6_FOUND)
set(PYSIDE_INCLUDE_DIR ${PySide6_INCLUDE_DIRS} CACHE INTERNAL "")
set(PYSIDE_LIBRARY ${PySide6_LIBRARIES} CACHE INTERNAL "")
set(PYSIDE_FOUND TRUE CACHE BOOL "(Backwards compatibility PySide6->PySide2) Whether PySide was found")
set(PYSIDE_MAJOR_VERSION 6 CACHE INTERNAL 6)
endif()