]> git.cworth.org Git - apitrace/blob - thirdparty/snappy/CMakeLists.txt
Replicate some of snappy autoconf tests.
[apitrace] / thirdparty / snappy / CMakeLists.txt
1 # We only do the subset of the snappy autoconf that actually affect the library
2 # (as most of them are for the tests which we don't build.)
3
4 include (CheckIncludeFileCXX)
5 include (CheckCXXSourceCompiles)
6 include (TestBigEndian)
7
8 check_include_file_cxx (sys/mman.h HAVE_SYS_MMAN_H)
9
10 check_cxx_source_compiles (
11     "main() { return __builtin_expect(1, 1) ? 1 : 0; }"
12     HAVE_BUILTIN_EXPECT
13 )
14
15 check_cxx_source_compiles (
16     "main() { return (__builtin_ctzll(0x100000000LL) == 32) ? 1 : 0; }"
17     HAVE_BUILTIN_CTZ
18 )
19
20 test_big_endian (WORDS_BIGENDIAN)
21
22 configure_file (config.h.in config.h)
23
24 add_definitions (-DHAVE_CONFIG_H)
25
26
27 include_directories (${CMAKE_CURRENT_BINARY_DIR})
28
29 add_library (snappy_bundled STATIC
30     snappy.cc
31     snappy-sinksource.cc
32     snappy-stubs-internal.cc
33     snappy-c.cc
34 )
35
36 set_target_properties (snappy_bundled PROPERTIES
37     COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
38 )