Skip to content

Instantly share code, notes, and snippets.

@Jawabiscuit
Created February 8, 2022 14:01
Show Gist options
  • Save Jawabiscuit/7926a04f4007b17a8e90bc5d792fa73b to your computer and use it in GitHub Desktop.
Save Jawabiscuit/7926a04f4007b17a8e90bc5d792fa73b to your computer and use it in GitHub Desktop.
Prints all cmake variables or variables that match a regex.
# https://stackoverflow.com/a/9328525
function(dump_cmake_variables)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
endif()
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
endfunction()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment