1
0
mirror of synced 2024-12-22 12:40:00 +01:00

fix: move explanation for clarity

This commit is contained in:
Andrew Minh Nguyen 2024-07-02 14:35:05 -05:00
parent 8abc4092b7
commit 0c534d5eaf

View File

@ -1,9 +1,9 @@
# Do's and Don'ts # Do's and Don'ts
## CMake Antipatterns
The next two lists are heavily based on the excellent gist [Effective Modern CMake]. That list is much longer and more detailed, feel free to read it as well. The next two lists are heavily based on the excellent gist [Effective Modern CMake]. That list is much longer and more detailed, feel free to read it as well.
## CMake Antipatterns
- **Do not use global functions**: This includes `link_directories`, `include_libraries`, and similar. - **Do not use global functions**: This includes `link_directories`, `include_libraries`, and similar.
- **Don't add unneeded PUBLIC requirements**: You should avoid forcing something on users that is not required (`-Wall`). Make these PRIVATE instead. - **Don't add unneeded PUBLIC requirements**: You should avoid forcing something on users that is not required (`-Wall`). Make these PRIVATE instead.
- **Don't GLOB files**: Make or another tool will not know if you add files without rerunning CMake. Note that CMake 3.12 adds a `CONFIGURE_DEPENDS` flag that makes this far better if you need to use it. - **Don't GLOB files**: Make or another tool will not know if you add files without rerunning CMake. Note that CMake 3.12 adds a `CONFIGURE_DEPENDS` flag that makes this far better if you need to use it.