mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 08:24:39 -07:00
simplify legacy qtdir logic
This commit is contained in:
parent
a617d32ddf
commit
b2ce234b96
2 changed files with 22 additions and 49 deletions
|
|
@ -53,21 +53,6 @@ if(WIN32 OR USE_VCPKG) # Windows (including 64bit) or USE_VCPKG set
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||||
CACHE FILEPATH "Vcpkg toolchain file"
|
CACHE FILEPATH "Vcpkg toolchain file"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show warning if QTDIR is NOT defined
|
|
||||||
if(NOT QTDIR
|
|
||||||
AND NOT DEFINED ENV{QTDIR}
|
|
||||||
AND NOT DEFINED ENV{QTDIR64}
|
|
||||||
)
|
|
||||||
set(QTDIR
|
|
||||||
""
|
|
||||||
CACHE PATH "Path to Qt (e.g. C:/Qt/6.4.2/msvc2019_64)"
|
|
||||||
)
|
|
||||||
message(
|
|
||||||
WARNING
|
|
||||||
"QTDIR variable is missing. Please set this variable to specify path to Qt (e.g. C:/Qt/6.4.2/msvc2019_64)"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# A project name is needed for CPack
|
# A project name is needed for CPack
|
||||||
|
|
@ -196,16 +181,11 @@ endif()
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if(DEFINED QTDIR)
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${QTDIR}")
|
|
||||||
elseif(DEFINED ENV{QTDIR})
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH "$ENV{QTDIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Update Translations: ${UPDATE_TRANSLATIONS}")
|
message(STATUS "Update Translations: ${UPDATE_TRANSLATIONS}")
|
||||||
|
|
||||||
include(FindQtRuntime)
|
include(FindQtRuntime)
|
||||||
|
|
||||||
|
# Qt is located through normal CMake package discovery
|
||||||
find_package(Qt6 6.4 REQUIRED)
|
find_package(Qt6 6.4 REQUIRED)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC TRUE)
|
set(CMAKE_AUTOMOC TRUE)
|
||||||
|
|
|
||||||
|
|
@ -8,49 +8,42 @@
|
||||||
# Output: TEST_QT_MODULES
|
# Output: TEST_QT_MODULES
|
||||||
|
|
||||||
set(REQUIRED_QT_COMPONENTS Core)
|
set(REQUIRED_QT_COMPONENTS Core)
|
||||||
|
|
||||||
if(WITH_SERVER)
|
if(WITH_SERVER)
|
||||||
set(_SERVATRICE_NEEDED Network Sql WebSockets)
|
list(APPEND REQUIRED_QT_COMPONENTS Network Sql WebSockets)
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CLIENT)
|
if(WITH_CLIENT)
|
||||||
set(_COCKATRICE_NEEDED
|
list(
|
||||||
Concurrent
|
APPEND
|
||||||
Gui
|
REQUIRED_QT_COMPONENTS
|
||||||
Multimedia
|
Concurrent
|
||||||
Network
|
Gui
|
||||||
PrintSupport
|
Multimedia
|
||||||
ShaderTools
|
Network
|
||||||
Svg
|
PrintSupport
|
||||||
WebSockets
|
ShaderTools
|
||||||
Widgets
|
Svg
|
||||||
Xml
|
WebSockets
|
||||||
Quick
|
Widgets
|
||||||
QuickWidgets
|
Xml
|
||||||
|
Quick
|
||||||
|
QuickWidgets
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(WITH_ORACLE)
|
if(WITH_ORACLE)
|
||||||
set(_ORACLE_NEEDED Concurrent Network Svg Widgets)
|
list(APPEND REQUIRED_QT_COMPONENTS Concurrent Network Svg Widgets)
|
||||||
endif()
|
endif()
|
||||||
if(TEST)
|
if(TEST)
|
||||||
# Union of Qt modules required across all test targets (independent of application targets).
|
# Union of Qt modules required across all test targets (independent of application targets).
|
||||||
# When adding a new test that needs additional Qt modules, add them here rather than in the test's CMakeLists.txt.
|
# When adding a new test that needs additional Qt modules, add them here rather than in the test's CMakeLists.txt
|
||||||
set(_TEST_NEEDED Concurrent Network Svg Widgets)
|
list(APPEND REQUIRED_QT_COMPONENTS Concurrent Network Svg Widgets)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(REQUIRED_QT_COMPONENTS ${REQUIRED_QT_COMPONENTS} ${_SERVATRICE_NEEDED} ${_COCKATRICE_NEEDED} ${_ORACLE_NEEDED}
|
|
||||||
${_TEST_NEEDED}
|
|
||||||
)
|
|
||||||
list(REMOVE_DUPLICATES REQUIRED_QT_COMPONENTS)
|
list(REMOVE_DUPLICATES REQUIRED_QT_COMPONENTS)
|
||||||
|
|
||||||
# Find Qt and all required components including Linguist
|
# Find Qt and all required components including Linguist
|
||||||
find_package(
|
find_package(Qt6 REQUIRED COMPONENTS ${REQUIRED_QT_COMPONENTS} Linguist)
|
||||||
Qt6
|
|
||||||
COMPONENTS ${REQUIRED_QT_COMPONENTS} Linguist
|
|
||||||
QUIET HINTS ${Qt6_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT Qt6_FOUND)
|
|
||||||
message(FATAL_ERROR "No suitable version of Qt was found")
|
|
||||||
endif()
|
|
||||||
set(COCKATRICE_QT_VERSION_NAME Qt6)
|
set(COCKATRICE_QT_VERSION_NAME Qt6)
|
||||||
|
|
||||||
list(FIND Qt6LinguistTools_TARGETS Qt6::lrelease QT6_LRELEASE_INDEX)
|
list(FIND Qt6LinguistTools_TARGETS Qt6::lrelease QT6_LRELEASE_INDEX)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue