xxHash/cmake_unofficial
Yann Collet a642aba0f5 transferred implementation inside xxhash.h
instead of xxhash.c .

This seems preferable for some build systems,
which don't like the `#include "xxhash.c"` statement
when inlining xxhash, as reported by @pdillinger .

Note that `xxhash.c` still exists,
it just includes the implementation and instantiates it.
2019-11-04 16:04:28 -08:00
..
.gitignore updated CMakeFile .gitignore 2019-03-16 07:07:38 -07:00
CMakeLists.txt transferred implementation inside xxhash.h 2019-11-04 16:04:28 -08:00
README.md Update cmake_unofficial/README.md 2019-07-30 15:57:07 +07:00
xxHashConfig.cmake.in Add CMake Config. 2019-07-28 19:07:03 +07:00

Usage

Way 1: import targets

Build xxHash targets:

cd </path/to/xxHash/>
mkdir build
cd build
cmake ../cmake_unofficial [options]
cmake --build .
cmake --build . --target install #optional

Where possible options are:

  • -DXXHASH_BUILD_ENABLE_INLINE_API=<ON|OFF> : adds xxhash.c for the -DXXH_INLINE_ALL api. ON by default.
  • -DXXHASH_BUILD_XXHSUM=<ON|OFF> : build the command line binary. ON by default
  • -DBUILD_SHARED_LIBS=<ON|OFF> : build dynamic library. ON by default.
  • -DCMAKE_INSTALL_PREFIX=<path> : use custom install prefix path.

Add lines into downstream CMakeLists.txt:

find_package(xxHash 0.7 CONFIG REQUIRED)
...
target_link_libraries(MyTarget PRIVATE xxHash::xxhash)

Way 2: Add subdirectory

Add lines into downstream CMakeLists.txt:

option(BUILD_SHARE_LIBS "Build shared libs" OFF) #optional
...
set(XXHASH_BUILD_ENABLE_INLINE_API OFF) #optional
set(XXHASH_BUILD_XXHSUM OFF) #optional
add_subdirectory(</path/to/xxHash/cmake_unofficial/> </path/to/xxHash/build/> EXCLUDE_FROM_ALL)
...
target_link_libraries(MyTarget PRIVATE xxHash::xxhash)