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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章