myx/MyxCMake/lib/macro/FindPackages.cmake

35 lines
847 B
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)
set(multiValueArgs PACKAGES Boost Qt5 Qt5Private)
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()
foreach(iter IN LISTS oneValueArgs multiValueArgs)
unset(ARG_${iter})
endforeach()
unset(ARG_UNPARSED_ARGUMENTS)
unset(multiValueArgs)
unset(oneValueArgs)
unset(options)
2022-10-08 22:02:58 +00:00
endmacro(myx_find_required_packages)