cmake/nc_deps.cmake

23 lines
682 B
CMake
Raw Permalink Normal View History

# Loads the provided arguments as components from find_package(cruft) if at least one is missing
macro (nc_deps)
if (${ARGC} LESS_EQUAL 0)
message (FATAL_ERROR "nc_deps requires at least one component")
endif ()
set (__nc_deps_lib_FAIL)
foreach (__nc_deps_lib ${ARGN})
if (NOT TARGET cruft::${__nc_deps_lib})
message (WARNING "missing cruft::${lib}")
set (__nc_deps_lib_FAIL 1)
break ()
endif()
endforeach ()
if (DEFINED __nc_deps_lib_FAIL)
message (STATUS "using find_package for cruft::${ARGN}")
find_package(cruft CONFIG REQUIRED COMPONENTS ${ARGN})
endif ()
endmacro ()