|
|
@@ -0,0 +1,155 @@ |
|
|
|
# CMake Modules |
|
|
|
|
|
|
|
Collection of usefull CMake modules. |
|
|
|
|
|
|
|
# Collection |
|
|
|
|
|
|
|
## cmake_tests |
|
|
|
|
|
|
|
Add a `tests` target to automatically build and run all tests. |
|
|
|
|
|
|
|
**Usage:** |
|
|
|
|
|
|
|
Add a new test with name `fuu` that depends on target `bar`. |
|
|
|
|
|
|
|
```cmake |
|
|
|
Add_CMake_Test ( NAME fuu |
|
|
|
TARGET bar |
|
|
|
[ GROUP baz ] |
|
|
|
[ COMMAND /bin/sh do_something ] ) |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
**Parameters** |
|
|
|
|
|
|
|
| Parameter | Description | |
|
|
|
| --- | --- | |
|
|
|
| `NAME <name>` | Name of the test. | |
|
|
|
| `TARGET <target>` | Taget the test depends on. | |
|
|
|
| `GROUP <group>` | Add the test to the passed group. | |
|
|
|
| `COMMAND <args..>` | Command to execute for testing. If no command is passed the passed target is executed. | |
|
|
|
|
|
|
|
## find_local_modules |
|
|
|
|
|
|
|
Helper function to include a local module into the cmake environment. |
|
|
|
|
|
|
|
**Usage:** |
|
|
|
|
|
|
|
```cmake |
|
|
|
FindLocalModule ( <module-name> <local-path> ) |
|
|
|
``` |
|
|
|
|
|
|
|
**Parameters** |
|
|
|
|
|
|
|
| Parameter | Description | |
|
|
|
| --- | --- | |
|
|
|
| `<module-name>` | Name of the module to add to cmake environment. | |
|
|
|
| `<local-path>` | Path to the local module. | |
|
|
|
|
|
|
|
## pedantic |
|
|
|
|
|
|
|
Helper functions to add pedantic flags to the compiler. |
|
|
|
|
|
|
|
**Pedantic_Apply_Flags:** |
|
|
|
|
|
|
|
Add pedantic flags to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`. |
|
|
|
|
|
|
|
```cmake |
|
|
|
Pedantic_Apply_Flags ( [ C ] |
|
|
|
[ CXX ] |
|
|
|
[ ALL ] |
|
|
|
[ IGNORE <flags..> ] |
|
|
|
[ IGNORE_C <flags..> ] |
|
|
|
[ IGNORE_CXX <flags..> ] |
|
|
|
[ ADDITIONAL <flags..> ] |
|
|
|
[ ADDITIONAL_C <flags..> ] |
|
|
|
[ ADDITIONAL_CXX <flags..> ] ) |
|
|
|
``` |
|
|
|
|
|
|
|
**Parameters:** |
|
|
|
|
|
|
|
| Parameter | Description | |
|
|
|
| --- | --- | |
|
|
|
| `C <flags..>` | Only add flags to the C compiler. | |
|
|
|
| `CXX <flags..>` | Only add flags to the C++ compiler. | |
|
|
|
| `ALL <flags..>` | Add flags to all compilers. | |
|
|
|
| `IGNORE <flags..>` | List of compiler flags to ignore. | |
|
|
|
| `IGNORE_C <flags..>` | List of C compiler flags to ignore. | |
|
|
|
| `IGNORE_CXX <flags..>` | List of C++ compiler flags to ignore. | |
|
|
|
| `ADDITIONAL <flags..>` | List of additional compiler flags to ignore. | |
|
|
|
| `ADDITIONAL_C <flags..>` | List of additional C compiler flags to ignore. | |
|
|
|
| `ADDITIONAL_CXX <flags..>` | List of additional C++ compiler flags to ignore. | |
|
|
|
|
|
|
|
**Pedantic_Apply_Flags_Target:** |
|
|
|
|
|
|
|
Add pedantic flags for compilers to the given target. |
|
|
|
|
|
|
|
```cmake |
|
|
|
Pedantic_Apply_Flags_Target ( <target> |
|
|
|
[ C ] |
|
|
|
[ CXX ] |
|
|
|
[ ALL ] |
|
|
|
[ IGNORE <flags..> ] |
|
|
|
[ IGNORE_C <flags..> ] |
|
|
|
[ IGNORE_CXX <flags..> ] |
|
|
|
[ ADDITIONAL <flags..> ] |
|
|
|
[ ADDITIONAL_C <flags..> ] |
|
|
|
[ ADDITIONAL_CXX <flags..> ] |
|
|
|
[ VISIBILITY <PRIVATE|PUBLIC> ] ) |
|
|
|
``` |
|
|
|
|
|
|
|
**Parameters:** |
|
|
|
|
|
|
|
| Parameter | Description | |
|
|
|
| --- | --- | |
|
|
|
| `<target>` | Target to add flags to. | |
|
|
|
| `C <flags..>` | Only add flags to the C compiler. | |
|
|
|
| `CXX <flags..>` | Only add flags to the C++ compiler. | |
|
|
|
| `ALL <flags..>` | Add flags to all compilers. | |
|
|
|
| `IGNORE <flags..>` | List of compiler flags to ignore. | |
|
|
|
| `IGNORE_C <flags..>` | List of C compiler flags to ignore. | |
|
|
|
| `IGNORE_CXX <flags..>` | List of C++ compiler flags to ignore. | |
|
|
|
| `ADDITIONAL <flags..>` | List of additional compiler flags to ignore. | |
|
|
|
| `ADDITIONAL_C <flags..>` | List of additional C compiler flags to ignore. | |
|
|
|
| `ADDITIONAL_CXX <flags..>` | List of additional C++ compiler flags to ignore. | |
|
|
|
| `VISIBILITY <PRIVATE|PUBLIC>` | Visibility to use to add flags to the target. | |
|
|
|
|
|
|
|
**Pedantic_Test_Flags:** |
|
|
|
|
|
|
|
Check if the passed flags are supported by the compiler. |
|
|
|
|
|
|
|
```cmake |
|
|
|
Pedantic_Test_Flags ( <C|CXX> <out-var> <flags..> ) |
|
|
|
``` |
|
|
|
|
|
|
|
**Parameters:** |
|
|
|
|
|
|
|
+ `<C|CXX>` Compiler to use for checking the flags |
|
|
|
+ `<out-var>` Name of the variable to store valid flags into. |
|
|
|
+ `<flags..>` Flags to check. |
|
|
|
|
|
|
|
## strip_symbols |
|
|
|
|
|
|
|
Strip thedebug symbols from the passed target. |
|
|
|
|
|
|
|
**Usage:** |
|
|
|
|
|
|
|
```cmake |
|
|
|
Strip_Symbols ( <target> <output> ) |
|
|
|
``` |
|
|
|
|
|
|
|
**Parameters** |
|
|
|
|
|
|
|
| Parameter | Description | |
|
|
|
| --- | --- | |
|
|
|
| `<target>` | Target to strip symbols from. | |
|
|
|
| `<output>` | Variable to store the path of the striped symbols to. | |
|
|
|
|
|
|
|
# Third Party |
|
|
|
|
|
|
|
+ [sanitizers-cmake](https://github.com/arsenm/sanitizers-cmake) |
|
|
|
+ Collection to add sanitizer support to cmake. |
|
|
|
+ Is merged into this project. |
|
|
|
+ [cotire](https://github.com/sakra/cotire) |
|
|
|
+ Collection to speed up the build process. |
|
|
|
+ Is merged into this project. |