mirror of
1
0
Fork 0

Updating trace mention

This commit is contained in:
Henry Fredrick Schreiner 2018-04-05 10:05:59 +02:00
parent 4897f2ae6f
commit 87f2f9ed27
3 changed files with 5 additions and 11 deletions

View File

@ -72,13 +72,12 @@ This book tries to solve the problem of the poor examples and best practices tha
## Other sources:
* [The official help](https://cmake.org/cmake/help/latest/): Really amazing documentation. Nicely organized, great search, and you can toggle versions at the top. It just doesn't have a great "best practices tutorial", which is what this book tries to fill in.
* [Effective Modern CMake](https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1): A great list of do's and don'ts.
* [Embracing Modern CMake][Modern CMake]: A post with good description of the term
* [It's time to do CMake Right](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/)
* [It's time to do CMake Right](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/): A nice set of best practices for Modern CMake projects.
[^1]: CMake 3.0 also removed several long deprecated features from very old versions of CMake and make one very tiny backwards incompatible change to syntax related to square brackets, so this is not entirely fair; there might be some very, very old CMake files that would stop working with 3. I've never seen one, though.
[Modern CMake]: https://steveire.wordpress.com/2017/11/05/embracing-modern-cmake/

View File

@ -82,6 +82,7 @@ You can now cross-compile to Android. Useful new if statement options really hel
* `LINK_WHAT_YOU_USE` added
* Lots of custom properties related to files and directories
* CMake Server added
* Added `--trace-source="filename"` to monitor certain files only
## [CMake 3.8] : C# & CUDA

View File

@ -60,13 +60,7 @@ These are common CMake options to most packages:
* `-DCMAKE_INSTALL_PREFIX=` The location to install to. System install on UNIX would often be `/usr/local` (the default), user directories are often `~/.local`, or you can pick a folder.
* `-D BUILD_SHARED_LIBS=` You can set this `ON` or `OFF` to control the default for shared libraries (the author can pick one vs. the other explicitly instead of using the default, though)
## Special commands for CMake
## Debugging your CMake files
We've already mentioned several special commands, like `-G` for generator, but here is a listing of some other useful flags:
| Flag | Description |
|-----:|:------------|
| `-G"Generator"` | Select a generator |
| `--trace` | Print every line of CMake that is run. Very verbose. |
| `--trace-source="filename"` | Print out every line of a CMake file when it runs. Very useful. |
We've already mentioned verbose output for the build, but you can also see verbose CMake configure output too. The `--trace` option will print every line of CMake that is run. Since this is very verbose, CMake 3.7 added `--trace-source="filename"`, which will print out every executed line of just the file you are interested in when it runs. If you select the name of the file you are interested in debugging (usually with a parent directory if you are debugging a CMakeLists.txt, since all of those have the same name), you can just see the lines that run in that file. Very useful!