deps: add a small helper to locate lists of nerdcruft dependencies
This commit is contained in:
parent
c688cf9dbb
commit
084fabb000
1
nc.cmake
1
nc.cmake
@ -19,3 +19,4 @@ include ("${CMAKE_CURRENT_LIST_DIR}/nc_sanitizer.cmake")
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_platform.cmake")
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_optimisation.cmake")
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_warnings.cmake")
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_deps.cmake")
|
22
nc_deps.cmake
Normal file
22
nc_deps.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
# 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 ()
|
||||
|
Loading…
Reference in New Issue
Block a user