myx/MyxCMake/lib/macro/FindPackages.cmake

45 lines
1.1 KiB
CMake
Raw Normal View History

2022-10-04 03:08:31 +00:00
include_guard(GLOBAL)
2022-10-08 22:15:27 +00:00
macro(myx_find_required_packages)
2022-10-04 03:08:31 +00:00
set(options)
set(oneValueArgs)
2023-07-30 07:10:29 +00:00
set(multiValueArgs PACKAGES Boost Qt5 Qt5Private Qt6 Qt6Private)
2022-10-04 03:08:31 +00:00
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
foreach(iter ${ARG_PACKAGES})
find_package(${iter} REQUIRED)
endforeach()
if(ARG_Boost)
find_package(Boost COMPONENTS ${ARG_Boost} REQUIRED)
endif()
if(ARG_Qt5)
find_package(Qt5 COMPONENTS ${ARG_Qt5} REQUIRED)
endif()
if(ARG_Qt5Private)
foreach(iter ${ARG_Qt5Private})
find_package("Qt5${iter}" COMPONENTS Private REQUIRED)
endforeach()
endif()
2023-07-30 07:10:29 +00:00
if(ARG_Qt6)
find_package(Qt6 COMPONENTS ${ARG_Qt6} REQUIRED)
endif()
if(ARG_Qt6Private)
foreach(iter ${ARG_Qt6Private})
find_package("Qt6${iter}" COMPONENTS Private REQUIRED)
endforeach()
endif()
2022-10-24 17:03:42 +00:00
foreach(__iter IN LISTS oneValueArgs multiValueArgs)
unset(ARG_${__iter})
2022-10-04 03:08:31 +00:00
endforeach()
unset(ARG_UNPARSED_ARGUMENTS)
unset(multiValueArgs)
unset(oneValueArgs)
unset(options)
2022-10-08 22:02:58 +00:00
endmacro(myx_find_required_packages)