Рефакторинг myx_find_qt
This commit is contained in:
parent
1957cbdb5c
commit
0c9573d005
@ -1,34 +1,35 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
macro(myx_find_qt)
|
||||
set(options)
|
||||
set(options REQUIRED)
|
||||
set(oneValueArgs VERSION)
|
||||
set(multiValueArgs COMPONENTS PRIVATE)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(ARG_VERSION)
|
||||
set(myx_qt_ver "${ARG_VERSION}")
|
||||
else()
|
||||
set(myx_qt_ver "5")
|
||||
if(NOT ARG_VERSION)
|
||||
set(ARG_VERSION "5")
|
||||
if(QT_DEFAULT_MAJOR_VERSION)
|
||||
set(myx_qt_ver "${QT_DEFAULT_MAJOR_VERSION}")
|
||||
set(ARG_VERSION "${QT_DEFAULT_MAJOR_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT (myx_qt_ver STREQUAL "5" OR myx_qt_ver STREQUAL "6"))
|
||||
myx_message_fatal_error("Supported Qt versions are 5 and 6")
|
||||
if(ARG_REQUIRED)
|
||||
set(ARG_REQUIRED "REQUIRED")
|
||||
endif()
|
||||
|
||||
if(NOT (ARG_VERSION STREQUAL "5" OR ARG_VERSION STREQUAL "6"))
|
||||
message(FATAL_ERROR "Supported Qt versions are 5 and 6")
|
||||
endif()
|
||||
|
||||
foreach(iter ${ARG_COMPONENTS})
|
||||
find_package(Qt${myx_qt_ver} COMPONENTS ${iter} REQUIRED)
|
||||
find_package(Qt${ARG_VERSION} COMPONENTS ${iter} ${ARG_REQUIRED})
|
||||
endforeach()
|
||||
|
||||
foreach(iter ${ARG_PRIVATE})
|
||||
find_package("Qt${myx_qt_ver}${iter}" COMPONENTS Private REQUIRED)
|
||||
find_package("Qt${ARG_VERSION}${iter}" COMPONENTS Private ${ARG_REQUIRED})
|
||||
endforeach()
|
||||
|
||||
unset(myx_qt_ver)
|
||||
foreach(__iter IN LISTS oneValueArgs multiValueArgs)
|
||||
unset(ARG_${__iter})
|
||||
endforeach()
|
||||
|
Loading…
Reference in New Issue
Block a user