You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 4.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # CMake Modules
  2. Collection of usefull CMake modules.
  3. # Collection
  4. ## cmake_tests
  5. Add a `tests` target to automatically build and run all tests.
  6. **Usage:**
  7. Add a new test with name `fuu` that depends on target `bar`.
  8. ```cmake
  9. Add_CMake_Test ( NAME fuu
  10. TARGET bar
  11. [ GROUP baz ]
  12. [ COMMAND /bin/sh do_something ] )
  13. ```
  14. **Parameters**
  15. | Parameter | Description |
  16. | --- | --- |
  17. | `NAME <name>` | Name of the test. |
  18. | `TARGET <target>` | Taget the test depends on. |
  19. | `GROUP <group>` | Add the test to the passed group. |
  20. | `COMMAND <args..>` | Command to execute for testing. If no command is passed the passed target is executed. |
  21. ## find_local_modules
  22. Helper function to include a local module into the cmake environment.
  23. **Usage:**
  24. ```cmake
  25. FindLocalModule ( <module-name> <local-path> )
  26. ```
  27. **Parameters**
  28. | Parameter | Description |
  29. | --- | --- |
  30. | `<module-name>` | Name of the module to add to cmake environment. |
  31. | `<local-path>` | Path to the local module. |
  32. ## pedantic
  33. Helper functions to add pedantic flags to the compiler.
  34. **Pedantic_Apply_Flags:**
  35. Add pedantic flags to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`.
  36. ```cmake
  37. Pedantic_Apply_Flags ( [ C ]
  38. [ CXX ]
  39. [ ALL ]
  40. [ IGNORE <flags..> ]
  41. [ IGNORE_C <flags..> ]
  42. [ IGNORE_CXX <flags..> ]
  43. [ ADDITIONAL <flags..> ]
  44. [ ADDITIONAL_C <flags..> ]
  45. [ ADDITIONAL_CXX <flags..> ] )
  46. ```
  47. **Parameters:**
  48. | Parameter | Description |
  49. | --- | --- |
  50. | `C <flags..>` | Only add flags to the C compiler. |
  51. | `CXX <flags..>` | Only add flags to the C++ compiler. |
  52. | `ALL <flags..>` | Add flags to all compilers. |
  53. | `IGNORE <flags..>` | List of compiler flags to ignore. |
  54. | `IGNORE_C <flags..>` | List of C compiler flags to ignore. |
  55. | `IGNORE_CXX <flags..>` | List of C++ compiler flags to ignore. |
  56. | `ADDITIONAL <flags..>` | List of additional compiler flags to ignore. |
  57. | `ADDITIONAL_C <flags..>` | List of additional C compiler flags to ignore. |
  58. | `ADDITIONAL_CXX <flags..>` | List of additional C++ compiler flags to ignore. |
  59. **Pedantic_Apply_Flags_Target:**
  60. Add pedantic flags for compilers to the given target.
  61. ```cmake
  62. Pedantic_Apply_Flags_Target ( <target>
  63. [ C ]
  64. [ CXX ]
  65. [ ALL ]
  66. [ IGNORE <flags..> ]
  67. [ IGNORE_C <flags..> ]
  68. [ IGNORE_CXX <flags..> ]
  69. [ ADDITIONAL <flags..> ]
  70. [ ADDITIONAL_C <flags..> ]
  71. [ ADDITIONAL_CXX <flags..> ]
  72. [ VISIBILITY <PRIVATE|PUBLIC> ] )
  73. ```
  74. **Parameters:**
  75. | Parameter | Description |
  76. | --- | --- |
  77. | `<target>` | Target to add flags to. |
  78. | `C <flags..>` | Only add flags to the C compiler. |
  79. | `CXX <flags..>` | Only add flags to the C++ compiler. |
  80. | `ALL <flags..>` | Add flags to all compilers. |
  81. | `IGNORE <flags..>` | List of compiler flags to ignore. |
  82. | `IGNORE_C <flags..>` | List of C compiler flags to ignore. |
  83. | `IGNORE_CXX <flags..>` | List of C++ compiler flags to ignore. |
  84. | `ADDITIONAL <flags..>` | List of additional compiler flags to ignore. |
  85. | `ADDITIONAL_C <flags..>` | List of additional C compiler flags to ignore. |
  86. | `ADDITIONAL_CXX <flags..>` | List of additional C++ compiler flags to ignore. |
  87. | `VISIBILITY <PRIVATE|PUBLIC>` | Visibility to use to add flags to the target. |
  88. **Pedantic_Test_Flags:**
  89. Check if the passed flags are supported by the compiler.
  90. ```cmake
  91. Pedantic_Test_Flags ( <C|CXX> <out-var> <flags..> )
  92. ```
  93. **Parameters:**
  94. + `<C|CXX>` Compiler to use for checking the flags
  95. + `<out-var>` Name of the variable to store valid flags into.
  96. + `<flags..>` Flags to check.
  97. ## strip_symbols
  98. Strip thedebug symbols from the passed target.
  99. **Usage:**
  100. ```cmake
  101. Strip_Symbols ( <target> <output> )
  102. ```
  103. **Parameters**
  104. | Parameter | Description |
  105. | --- | --- |
  106. | `<target>` | Target to strip symbols from. |
  107. | `<output>` | Variable to store the path of the striped symbols to. |
  108. # Third Party
  109. + [sanitizers-cmake](https://github.com/arsenm/sanitizers-cmake)
  110. + Collection to add sanitizer support to cmake.
  111. + Is merged into this project.
  112. + Files:
  113. + asan-wrapper
  114. + FindASan.cmake
  115. + FindMSan.cmake
  116. + FindSanitizers.cmake
  117. + FindTSan.cmake
  118. + FindUBSan.cmake
  119. + sanitize-helpers.cmake
  120. + [cotire](https://github.com/sakra/cotire)
  121. + Collection to speed up the build process.
  122. + Is merged into this project.
  123. + Files:
  124. + cotire.cmake