| 1 |
|
| 2 |
## Usage |
| 3 |
|
| 4 |
### Way 1: import targets |
| 5 |
Build xxHash targets: |
| 6 |
|
| 7 |
cd </path/to/xxHash/> |
| 8 |
mkdir build |
| 9 |
cd build |
| 10 |
cmake ../cmake_unofficial [options] |
| 11 |
cmake --build . |
| 12 |
cmake --build . --target install #optional |
| 13 |
|
| 14 |
Where possible options are: |
| 15 |
- `-DXXHASH_BUILD_ENABLE_INLINE_API=<ON|OFF>`: adds xxhash.c for the `-DXXH_INLINE_ALL` api. ON by default. |
| 16 |
- `-DXXHASH_BUILD_XXHSUM=<ON|OFF>`: build the command line binary. ON by default |
| 17 |
- `-DBUILD_SHARED_LIBS=<ON|OFF>`: build dynamic library. ON by default. |
| 18 |
- `-DCMAKE_INSTALL_PREFIX=<path>`: use custom install prefix path. |
| 19 |
- `-DDISPATCH=<ON|OFF>`: enable dispatch mode. OFF by default. |
| 20 |
|
| 21 |
Add lines into downstream CMakeLists.txt: |
| 22 |
|
| 23 |
find_package(xxHash 0.7 CONFIG REQUIRED) |
| 24 |
... |
| 25 |
target_link_libraries(MyTarget PRIVATE xxHash::xxhash) |
| 26 |
|
| 27 |
### Way 2: Add subdirectory |
| 28 |
Add lines into downstream CMakeLists.txt: |
| 29 |
|
| 30 |
option(BUILD_SHARED_LIBS "Build shared libs" OFF) #optional |
| 31 |
... |
| 32 |
set(XXHASH_BUILD_ENABLE_INLINE_API OFF) #optional |
| 33 |
set(XXHASH_BUILD_XXHSUM OFF) #optional |
| 34 |
add_subdirectory(</path/to/xxHash/cmake_unofficial/> </path/to/xxHash/build/> EXCLUDE_FROM_ALL) |
| 35 |
... |
| 36 |
target_link_libraries(MyTarget PRIVATE xxHash::xxhash) |
| 37 |
|