mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 02:41:49 -05:00
CMake: Use HINTS option instead of modifying CMAKE_PREFIX_PATH for Qt
This commit is contained in:
parent
078969bdd0
commit
2eec2c156b
1 changed files with 11 additions and 4 deletions
|
@ -189,22 +189,29 @@ if (ENABLE_QT)
|
||||||
|
|
||||||
if (DEFINED QT_VER)
|
if (DEFINED QT_VER)
|
||||||
download_bundled_external("qt/" ${QT_VER} QT_PREFIX)
|
download_bundled_external("qt/" ${QT_VER} QT_PREFIX)
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${QT_PREFIX}")
|
|
||||||
endif()
|
endif()
|
||||||
elseif (DEFINED ENV{QTDIR})
|
elseif (DEFINED ENV{QTDIR})
|
||||||
# Set CMAKE_PREFIX_PATH if QTDIR is defined in the environment This allows CMake to
|
# Set CMAKE_PREFIX_PATH if QTDIR is defined in the environment This allows CMake to
|
||||||
# automatically find the Qt packages on Windows
|
# automatically find the Qt packages on Windows
|
||||||
list(APPEND CMAKE_PREFIX_PATH "$ENV{QTDIR}")
|
set(QT_PREFIX "$ENV{QTDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Passing an empty HINTS seems to cause default system paths to get ignored in CMake 2.8 so make
|
||||||
|
# sure to not pass anything if we don't have one
|
||||||
|
if (DEFINED QT_PREFIX)
|
||||||
|
set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
|
||||||
|
else()
|
||||||
|
set(QT_PREFIX_HINT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT CITRA_FORCE_QT4)
|
if (NOT CITRA_FORCE_QT4)
|
||||||
find_package(Qt5 COMPONENTS Widgets OpenGL)
|
find_package(Qt5 COMPONENTS Widgets OpenGL ${QT_PREFIX_HINT})
|
||||||
set(CITRA_QT_LIBS Qt5::Widgets Qt5::OpenGL)
|
set(CITRA_QT_LIBS Qt5::Widgets Qt5::OpenGL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CITRA_FORCE_QT4 OR NOT Qt5_FOUND)
|
if (CITRA_FORCE_QT4 OR NOT Qt5_FOUND)
|
||||||
# Try to fallback to Qt4
|
# Try to fallback to Qt4
|
||||||
find_package(Qt4 REQUIRED COMPONENTS QtGui QtOpenGL)
|
find_package(Qt4 REQUIRED COMPONENTS QtGui QtOpenGL ${QT_PREFIX_HINT})
|
||||||
set(CITRA_QT_LIBS Qt4::QtGui Qt4::QtOpenGL)
|
set(CITRA_QT_LIBS Qt4::QtGui Qt4::QtOpenGL)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue