forked from ruslo/hunter
-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathhunter_find_licenses.cmake
37 lines (31 loc) · 1.03 KB
/
hunter_find_licenses.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
# Copyright (c) 2017, Ruslan Baratov
# All rights reserved.
include(CMakeParseArguments) # cmake_parse_arguments
include(hunter_assert_not_empty_string)
# We must use macro to set variable to parent scope of the caller.
#
# In:
# * HUNTER_PACKAGE_HOME_DIR
# * HUNTER_PACKAGE_LICENSE_SEARCH_DIR
# * HUNTER_PACKAGE_NAME
# * HUNTER_PACKAGE_SCHEME_UNPACK
# * HUNTER_PACKAGE_SHA1
# Out:
# * ${HUNTER_PACKAGE_NAME}_LICENSES (parent scope)
macro(hunter_find_licenses)
hunter_assert_not_empty_string("${HUNTER_PACKAGE_LICENSE_SEARCH_DIR}")
hunter_assert_not_empty_string("${HUNTER_PACKAGE_NAME}")
file(GLOB _licenses "${HUNTER_PACKAGE_LICENSE_SEARCH_DIR}/*")
set("${HUNTER_PACKAGE_NAME}_LICENSES" "${_licenses}" PARENT_SCOPE)
# HACK (to refactor) {
if(HUNTER_PACKAGE_SCHEME_UNPACK)
hunter_assert_not_empty_string("${HUNTER_PACKAGE_HOME_DIR}")
hunter_assert_not_empty_string("${HUNTER_PACKAGE_SHA1}")
file(
WRITE
"${HUNTER_PACKAGE_HOME_DIR}/cache.sha1"
"${HUNTER_PACKAGE_SHA1}"
)
endif()
# }
endmacro()