CMake:打印出脚本中所有可访问的变量 - CMake: Print out all accessible variables in a script

问题:

I'm wondering if there is a way to print out all accessible variables in CMake.我想知道是否有办法在 CMake 中打印出所有可访问的变量。 I'm not interested in the CMake variables - as in the --help-variables option.我对 CMake 变量不感兴趣——就像在--help-variables选项中一样。 I'm talking about my variables that I defined, or the variables defined by included scripts.我说的是我定义的变量,或者包含脚本定义的变量。

I'm currently including:我目前包括:

INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)

And I was hoping that I could just print out all the variables that are here, instead of having to go through all the files and read what was available - I may find some variables I didn't know about that may be useful.我希望我可以打印出这里的所有变量,而不必浏览所有文件并阅读可用的内容 - 我可能会发现一些我不知道的变量可能有用。 It would be good to aid learning & discovery.帮助学习和发现会很好。 It is strictly for debugging/development.它严格用于调试/开发。

This is similar to the question in Print all local variables accessible to the current scope in Lua , but for CMake!这类似于打印 Lua 中当前作用域可访问的所有局部变量中的问题,但对于 CMake!

Has anyone done this?有没有人做过这个?


解决方案:

参考一: https://stackoom.com/question/d0uE
参考二: CMake: Print out all accessible variables in a script
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章