Skip to content

Instantly share code, notes, and snippets.

@sighingnow
Last active June 5, 2022 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sighingnow/c8e153cd6cbd6b0084b36aa5f75db09d to your computer and use it in GitHub Desktop.
Save sighingnow/c8e153cd6cbd6b0084b36aa5f75db09d to your computer and use it in GitHub Desktop.
Print all accessible variables in current context in CMake
function(print_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