Skip to content

Commit 22d0d11

Browse files
committed
Use 'hunter_get_configuration_types'
1 parent 95e9e8d commit 22d0d11

File tree

2 files changed

+25
-46
lines changed

2 files changed

+25
-46
lines changed

Diff for: cmake/modules/hunter_configuration_types.cmake

+19-31
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,26 @@
33

44
include(CMakeParseArguments) # cmake_parse_arguments
55

6-
include(hunter_user_error)
6+
include(hunter_assert_not_empty_string)
7+
include(hunter_assert_empty_string)
78

8-
macro(hunter_configuration_types)
9-
set(_hunter_multiple_values CONFIGURATION_TYPES)
10-
cmake_parse_arguments(
11-
_hunter
12-
""
13-
""
14-
"${_hunter_multiple_values}"
15-
${ARGV}
16-
)
17-
list(LENGTH _hunter_UNPARSED_ARGUMENTS _hunter_len)
18-
if(NOT ${_hunter_len} EQUAL 1)
19-
hunter_user_error("unparsed: ${_hunter_UNPARSED_ARGUMENTS}")
20-
endif()
9+
function(hunter_configuration_types package)
10+
hunter_assert_not_empty_string("${package}")
2111

22-
list(GET _hunter_UNPARSED_ARGUMENTS 0 _hunter_current_project)
12+
set(optional "")
13+
set(one "")
14+
set(multiple CONFIGURATION_TYPES)
2315

24-
# Set value only if not defined in 'config.cmake',
25-
# i.e. when *_CONFIGURATIONS_TYPES is empty
26-
string(
27-
COMPARE
28-
EQUAL
29-
"${HUNTER_${_hunter_current_project}_CONFIGURATION_TYPES}"
30-
""
31-
_hunter_is_empty
32-
)
16+
# Introduce:
17+
# * x_CONFIGURATION_TYPES
18+
cmake_parse_arguments(x "" "" "${multiple}" "${ARGN}")
3319

34-
if(_hunter_is_empty)
35-
set(
36-
"HUNTER_${_hunter_current_project}_CONFIGURATION_TYPES"
37-
${_hunter_CONFIGURATION_TYPES}
38-
)
39-
endif()
40-
endmacro()
20+
hunter_assert_empty_string("${x_UNPARSED_ARGUMENTS}")
21+
hunter_assert_not_empty_string("${x_CONFIGURATION_TYPES}")
22+
23+
set(
24+
"__HUNTER_DEFAULT_CONFIGURATION_TYPES_${package}"
25+
"${x_CONFIGURATION_TYPES}"
26+
PARENT_SCOPE
27+
)
28+
endfunction()

Diff for: cmake/modules/hunter_download.cmake

+6-15
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
include(CMakeParseArguments) # cmake_parse_arguments
77

8+
include(hunter_assert_not_empty_string)
89
include(hunter_create_args_file)
910
include(hunter_download_server_url)
1011
include(hunter_find_licenses)
1112
include(hunter_find_stamps)
1213
include(hunter_get_cacheable)
14+
include(hunter_get_configuration_types)
1315
include(hunter_internal_error)
1416
include(hunter_jobs_number)
1517
include(hunter_load_from_cache)
@@ -19,7 +21,6 @@ include(hunter_register_dependency)
1921
include(hunter_save_to_cache)
2022
include(hunter_status_debug)
2123
include(hunter_status_print)
22-
include(hunter_assert_not_empty_string)
2324
include(hunter_upload_cache)
2425
include(hunter_user_error)
2526

@@ -90,14 +91,11 @@ function(hunter_download)
9091
URL "${HUNTER_${h_name}_URL}"
9192
OUTPUT HUNTER_PACKAGE_URL
9293
)
93-
set(
94-
HUNTER_PACKAGE_CONFIGURATION_TYPES
95-
"${HUNTER_${h_name}_CONFIGURATION_TYPES}"
94+
95+
hunter_get_configuration_types(
96+
PACKAGE "${h_name}"
97+
OUT HUNTER_PACKAGE_CONFIGURATION_TYPES
9698
)
97-
string(COMPARE EQUAL "${HUNTER_PACKAGE_CONFIGURATION_TYPES}" "" no_types)
98-
if(no_types)
99-
set(HUNTER_PACKAGE_CONFIGURATION_TYPES ${HUNTER_CACHED_CONFIGURATION_TYPES})
100-
endif()
10199

102100
hunter_get_cacheable(
103101
PACKAGE "${h_name}"
@@ -107,8 +105,6 @@ function(hunter_download)
107105

108106
set(HUNTER_PACKAGE_PROTECTED_SOURCES "${HUNTER_${h_name}_PROTECTED_SOURCES}")
109107

110-
hunter_assert_not_empty_string("${HUNTER_PACKAGE_CONFIGURATION_TYPES}")
111-
112108
string(COMPARE EQUAL "${HUNTER_PACKAGE_URL}" "" hunter_no_url)
113109

114110
hunter_assert_not_empty_string("${HUNTER_PACKAGE_URL}")
@@ -509,11 +505,6 @@ function(hunter_download)
509505
hunter_status_debug("Download scheme: ${HUNTER_DOWNLOAD_SCHEME}")
510506
hunter_status_debug("Url: ${HUNTER_PACKAGE_URL}")
511507
hunter_status_debug("SHA1: ${HUNTER_PACKAGE_SHA1}")
512-
if(HUNTER_PACKAGE_SCHEME_INSTALL)
513-
hunter_status_debug(
514-
"Configuration types: ${HUNTER_PACKAGE_CONFIGURATION_TYPES}"
515-
)
516-
endif()
517508
hunter_status_debug("HUNTER_TLS_VERIFY: ${HUNTER_TLS_VERIFY}")
518509

519510
if(has_internal_deps_id)

0 commit comments

Comments
 (0)