40 lines
1002 B
CMake
40 lines
1002 B
CMake
include_guard(GLOBAL)
|
|
|
|
macro(myx_find_qt)
|
|
set(options)
|
|
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(QT_DEFAULT_MAJOR_VERSION)
|
|
set(myx_qt_ver "${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")
|
|
endif()
|
|
|
|
foreach(iter ${ARG_COMPONENTS})
|
|
find_package(Qt${myx_qt_ver} COMPONENTS ${iter} REQUIRED)
|
|
endforeach()
|
|
|
|
foreach(iter ${ARG_PRIVATE})
|
|
find_package("Qt${myx_qt_ver}${iter}" COMPONENTS Private REQUIRED)
|
|
endforeach()
|
|
|
|
unset(myx_qt_ver)
|
|
foreach(__iter IN LISTS oneValueArgs multiValueArgs)
|
|
unset(ARG_${__iter})
|
|
endforeach()
|
|
unset(ARG_UNPARSED_ARGUMENTS)
|
|
unset(multiValueArgs)
|
|
unset(oneValueArgs)
|
|
unset(options)
|
|
endmacro()
|