0

I'm generating a build tree for someone's project using their CMakeLists.txt, which contains a reference to a user-defined function. Unfortunately, the referenced source-tree is huge, and it's not clear to me where the function is defined.

Does cmake provide a means of discovering and printing the location of user-defined cmake function definitions?

If not, I'll just use another program to search for it, but I'm curious. It doesn't seem to be included with --system-information, but maybe there's another option that includes this sort of information.

starball
  • 20,030
  • 7
  • 43
  • 238
Mackie Messer
  • 1,126
  • 2
  • 8
  • 22
  • 1
    You could run CMake in a trace mode, where it prints all commands, including the `function` commands which define functions. Using `grep` or other processing tools for that trace you could find the needed function's definition. See that my answer about parsing CMake trace output in json format: https://stackoverflow.com/a/76315014/3440745. – Tsyvarev Jun 14 '23 at 17:55
  • @Tsyvarev --trace does the trick! Please feel free to post as an answer with any links to other relevant posts. – Mackie Messer Jun 14 '23 at 19:03

0 Answers0