Provide functions to find packages in batch
Dependencies can now be declared as a list and passed amongst modules since CMake does not (easily) support passing anonymous functions.
This commit is contained in:
parent
0deeef0127
commit
00b3f9431d
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_and_append (name args)
|
||||
# find_and_append_package (name args)
|
||||
#
|
||||
# where
|
||||
#
|
||||
@ -14,6 +14,25 @@
|
||||
#
|
||||
########################################################################
|
||||
#
|
||||
# - Generic inclusion of a list of packages
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_and_append_package_list (args)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# args List of package strings. Each string must be quoted if
|
||||
# it contains more than one word.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# find_and_append_package_list (
|
||||
# "Boost COMPONENTS filesystem REQUIRED"
|
||||
# SUPERLU
|
||||
# )
|
||||
########################################################################
|
||||
#
|
||||
# - Remove duplicate library declarations
|
||||
#
|
||||
# Synopsis:
|
||||
@ -57,6 +76,22 @@ macro (find_and_append_package name)
|
||||
find_and_append_package_to (${CMAKE_PROJECT_NAME} ${name} ${ARGN})
|
||||
endmacro (find_and_append_package name)
|
||||
|
||||
# find a list of dependencies, adding each one of them
|
||||
macro (find_and_append_package_list_to prefix)
|
||||
# setting and separating is necessary to work around apparent bugs
|
||||
# in CMake's parser (sic)
|
||||
set (_deps ${ARGN})
|
||||
foreach (_dep IN LISTS _deps)
|
||||
separate_arguments (_args UNIX_COMMAND ${_dep})
|
||||
find_and_append_package_to (${prefix} ${_args})
|
||||
endforeach (_dep)
|
||||
endmacro (find_and_append_package_list_to prefix)
|
||||
|
||||
# convenience method to supply the project name as prefix
|
||||
macro (find_and_append_package_list)
|
||||
find_and_append_package_list_to (${CMAKE_PROJECT_NAME} ${ARGN})
|
||||
endmacro (find_and_append_package_list)
|
||||
|
||||
# libraries should always be trimmed from the beginning, so that also
|
||||
# missing functions in those later in the list will be resolved
|
||||
macro (remove_duplicate_libraries module)
|
||||
|
Loading…
Reference in New Issue
Block a user