cmake: improve curl_dumpvars() and move to Utilities.cmake

Also:
- dump variable types.
- show which variables are marked as advanced.
- use `IN ITEMS`.

Closes #15562
This commit is contained in:
Viktor Szakats 2024-11-12 21:37:07 +01:00
parent dc874d4369
commit f58342ae21
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 18 additions and 9 deletions

View file

@ -33,3 +33,21 @@ function(count_true _output_count_var)
endforeach()
set(${_output_count_var} ${lst_len} PARENT_SCOPE)
endfunction()
# Dump all defined variables with their values
function(curl_dumpvars)
message("::group::CMake Variable Dump")
get_cmake_property(_vars VARIABLES)
foreach(_var IN ITEMS ${_vars})
get_property(_var_type CACHE ${_var} PROPERTY TYPE)
get_property(_var_advanced CACHE ${_var} PROPERTY ADVANCED)
if(_var_type)
set(_var_type ":${_var_type}")
endif()
if(_var_advanced)
set(_var_advanced " [adv]")
endif()
message("${_var}${_var_type}${_var_advanced} = ${${_var}}")
endforeach()
message("::endgroup::")
endfunction()