myx-cmake-example-features/cmake/myx/lib/macro/FindPackages.cmake

35 lines
851 B
CMake
Raw Normal View History

2022-10-06 12:22:57 +00:00
include_guard(GLOBAL)
2022-10-20 09:53:06 +00:00
macro(myx_find_required_packages)
2022-10-06 12:22:57 +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()
2023-02-17 11:36:44 +00:00
foreach(__iter IN LISTS oneValueArgs multiValueArgs)
unset(ARG_${__iter})
2022-10-06 12:22:57 +00:00
endforeach()
unset(ARG_UNPARSED_ARGUMENTS)
unset(multiValueArgs)
unset(oneValueArgs)
unset(options)
2022-10-20 09:53:06 +00:00
endmacro(myx_find_required_packages)