generated from koinos/koinos-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KoinosAddPackage.cmake
37 lines (27 loc) · 1.04 KB
/
KoinosAddPackage.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function(koinos_add_package PACKAGE)
set(options LOCAL CONFIG REQUIRED)
set(oneValueArgs NAME)
set(multiValueArgs ADD_COMPONENTS FIND_COMPONENTS)
cmake_parse_arguments(KOINOS_ADD_PACKAGE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
list(APPEND HUNTER_ADD_PACKAGE_ARGS ${PACKAGE})
if (KOINOS_ADD_PACKAGE_ADD_COMPONENTS)
list(APPEND HUNTER_ADD_PACKAGE_ARGS COMPONENTS ${KOINOS_ADD_PACKAGE_ADD_COMPONENTS})
endif()
hunter_add_package(${HUNTER_ADD_PACKAGE_ARGS})
list(APPEND FIND_PACKAGE_ARGS)
if (KOINOS_ADD_PACKAGE_NAME)
list(APPEND FIND_PACKAGE_ARGS ${KOINOS_ADD_PACKAGE_NAME})
else()
list(APPEND FIND_PACKAGE_ARGS ${PACKAGE})
endif()
if (${KOINOS_ADD_PACKAGE_CONFIG})
list(APPEND FIND_PACKAGE_ARGS CONFIG)
endif()
if (${KOINOS_ADD_PACKAGE_REQUIRED})
list(APPEND FIND_PACKAGE_ARGS REQUIRED)
endif()
if (KOINOS_ADD_PACKAGE_FIND_COMPONENTS)
list(APPEND FIND_PACKAGE_ARGS COMPONENTS ${KOINOS_ADD_PACKAGE_FIND_COMPONENTS})
endif()
find_package(${FIND_PACKAGE_ARGS})
endfunction()