README.md
1
2## Usage
3
4### Way 1: import targets
5Build 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
14Where 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
20Add lines into downstream CMakeLists.txt:
21
22 find_package(xxHash 0.7 CONFIG REQUIRED)
23 ...
24 target_link_libraries(MyTarget PRIVATE xxHash::xxhash)
25
26### Way 2: Add subdirectory
27Add lines into downstream CMakeLists.txt:
28
29 option(BUILD_SHARED_LIBS "Build shared libs" OFF) #optional
30 ...
31 set(XXHASH_BUILD_ENABLE_INLINE_API OFF) #optional
32 set(XXHASH_BUILD_XXHSUM OFF) #optional
33 add_subdirectory(</path/to/xxHash/cmake_unofficial/> </path/to/xxHash/build/> EXCLUDE_FROM_ALL)
34 ...
35 target_link_libraries(MyTarget PRIVATE xxHash::xxhash)
36
37