You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support vendoring kassert as part of other libraries (#66)
* Allow specifying a custom prefix.
* Formatting.
* Reorganize vendoring variables.
Users can tweak `KASSERT_CMAKE_NAMESPACE` (prefix to all targets),
`KASSERT_CXX_NAMESPACE`, `KASSERT_INCLUDE_SUBDIR` (the subdir to place
the headers into). The assertion macro prefix is derived from the C++
namespace.
Users may also choose to set `KASSERT_VENDOR_ID`. If any of the other
arguments is not given explicitly, it is derived passed on this variable.
* Allow setting `KASSERT_PREFIX` explicitely.
* Configure `kassertConfig.cmake` properly (also when vendoring).
* Only set `KASSERT_VENDOR_ID` to default if not defined yet.
* Make assertion level CMake properties work with vendoring.
* Add tests.
* Avoid installing test artifacts.
* Fix: correct namespacing target export set.
* Test if installation and using the installed library works.
* Fix CMake formatting.
* Build documentation correctly.
* Fix some usages of the vendoring knobs in CMake where they were missed.
* Make the tests work when vendoring.
* Fix CMake formatting.
* Documentation.
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,29 @@ constexpr int heavy = KAMPING_ASSERTION_LEVEL_HEAVY;
81
81
82
82
- C++17-ready compiler (GCC, Clang, ICX)
83
83
84
+
## Vendoring Support
85
+
86
+
KAssert can be embedded in other libraries with custom namespaces and macro names to prevent naming conflicts.
87
+
88
+
**When to vendor:** Use vendoring when developing a library that uses KAssert internally to avoid conflicts with user code that might also use KAssert.
89
+
90
+
### Configuration Variables
91
+
92
+
- `KASSERT_VENDOR_ID` - Base identifier for deriving other variables
93
+
- `KASSERT_CMAKE_NAMESPACE` - Prefix for all CMake targets
94
+
- `KASSERT_CXX_NAMESPACE` - C++ namespace for the library
95
+
- `KASSERT_INCLUDE_SUBDIR` - Subdirectory for header installation
96
+
- `KASSERT_PREFIX` - The prefix for all macros
97
+
98
+
### Example
99
+
100
+
```cmake
101
+
set(KASSERT_VENDOR_ID "myassert")
102
+
add_subdirectory(vendor/kassert)
103
+
```
104
+
105
+
This generates macros like `MYASSERT()` instead of `KASSERT()`.
106
+
84
107
## LICENSE
85
108
86
109
KAssert is released under the MIT License. See [LICENSE](LICENSE) for details.
Copy file name to clipboardExpand all lines: docs/main.dox
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,29 @@ constexpr int heavy = KAMPING_ASSERTION_LEVEL_HEAVY;
81
81
82
82
- C++17-ready compiler (GCC, Clang, ICX)
83
83
- Building this documentation requires `Doxygen 1.9.2` or newer
84
+
85
+
## Vendoring Support
86
+
87
+
KAssert can be embedded in other libraries with custom namespaces and macro names to prevent naming conflicts.
88
+
89
+
**When to vendor:** Use vendoring when developing a library that uses KAssert internally to avoid conflicts with user code that might also use KAssert.
90
+
91
+
### Configuration Variables
92
+
93
+
- `KASSERT_VENDOR_ID` - Base identifier for deriving other variables
94
+
- `KASSERT_CMAKE_NAMESPACE` - Prefix for all CMake targets
95
+
- `KASSERT_CXX_NAMESPACE` - C++ namespace for the library
96
+
- `KASSERT_INCLUDE_SUBDIR` - Subdirectory for header installation
97
+
- `KASSERT_PREFIX` - The prefix for all macros
98
+
99
+
### Example
100
+
101
+
```cmake
102
+
set(KASSERT_VENDOR_ID "myassert")
103
+
add_subdirectory(vendor/kassert)
104
+
```
105
+
106
+
This generates macros like `MYASSERT()` instead of `KASSERT()`.
0 commit comments