2

I want to know all the details of the CMake process such as

  • Which function it calls
  • Which path it searchs
  • Which caches it stores

I have tried --debug-output, and cmake-gui, but it's just not very detailed.

I don't like something that runs automatically without a report. It messes things up. For example, I have spent 2 hours to find out that CMake use Windows Registry "quietly" to get a path for "find_package()". This is really annoying.(Yes, if I had read EVERY word in the verbose document, I should have known it earlier)

Maybe the only way left for me is to look the source code of CMake? Actually, I have read CMake source code to fully understand the wield syntax of set()(Lists in CMake are just strings with semicolons delimiters)

usr1234567
  • 21,601
  • 16
  • 108
  • 128
flm8620
  • 1,411
  • 11
  • 15
  • `For example, I have spent 2 hours to find out that CMake use Windows Registry "quietly" to get a path for "find_package()".` - [Documentation](https://cmake.org/cmake/help/v3.5/command/find_package.html) for `find_package()` describes that (see step 7 of search algorithm). – Tsyvarev Oct 24 '16 at 17:37
  • Welcome to Stack Overflow. Yes, documentation on how-to debug CMake scripts itself could be better. So I requested/contributed to [a "Test and Debug" topic](http://stackoverflow.com/documentation/cmake/4098/test-and-debug) on SO Documentation. In short there are debug outputs for special tasks. For `find_package()` see [here](http://stackoverflow.com/documentation/cmake/4098/test-and-debug/21128/debug-find-package-errors) and for general information on file access/parsing see [here](http://stackoverflow.com/questions/30503631/cmake-in-which-order-are-files-parsed-cache-toolchain). – Florian Oct 24 '16 at 20:05
  • @Tsyvarev Yes, I have noticed this in doc just after knowing CMake uses Registry. My fault. But on the other hand, I think as a programming language, you can't count on every user to fully understand its documents before starting using it. – flm8620 Oct 25 '16 at 07:43
  • `you can't count on every user to fully understand its documents before starting using it.` - When starting with CMake, it is sufficient to know that `find_package()` **finds things** installed by system-specific means. When you create your own packages or install 3d-party ones into several locations, it is not `starting with CMake` by any means. So you need to read documentation more thoroughly. – Tsyvarev Oct 25 '16 at 07:54
  • @usr1234567 I think CMake Daemon Tools is what I want. – flm8620 Oct 25 '16 at 07:55
  • @flm8620: As mentioned in http://stackoverflow.com/a/38869732/2799037, you might want to upvote that answer and close this question. – usr1234567 Oct 25 '16 at 08:37
  • @usr1234567 Thx, I'm new here, not very familair with rules. – flm8620 Oct 25 '16 at 15:59

1 Answers1

1

Well, you can look inside the scripts in the share/cmake-3.x/Modules folder for your particular package in order to find out how exactly it looks for the package, and what paths and registry keys it tries.

Or you can use the Process Monitor to spy on the cmake process to see what files and registry keys it tries to access.

Archie
  • 2,644
  • 21
  • 21