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.)
4 include (CheckIncludeFileCXX)
5 include (CheckCXXSourceCompiles)
6 include (TestBigEndian)
8 check_include_file_cxx (sys/mman.h HAVE_SYS_MMAN_H)
9 check_include_file_cxx (sys/byteorder.h HAVE_SYS_BYTEORDER_H)
10 check_include_file_cxx (sys/endian.h HAVE_SYS_ENDIAN_H)
11 check_include_file_cxx (byteswap.h HAVE_BYTESWAP_H)
13 check_cxx_source_compiles (
14 "main() { return __builtin_expect(1, 1) ? 1 : 0; }"
18 check_cxx_source_compiles (
19 "main() { return (__builtin_ctzll(0x100000000LL) == 32) ? 1 : 0; }"
23 test_big_endian (WORDS_BIGENDIAN)
25 configure_file (config.h.in config.h)
27 add_definitions (-DHAVE_CONFIG_H)
30 if (CMAKE_COMPILER_IS_GNUCXX)
31 add_definitions (-Wno-unused-function)
35 include_directories (${CMAKE_CURRENT_BINARY_DIR})
37 add_library (snappy_bundled STATIC
40 snappy-stubs-internal.cc
44 set_target_properties (snappy_bundled PROPERTIES
45 COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
48 # If we're doing an out of source build remove any config.h from the source tree.
49 if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
53 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_SOURCE_DIR}/config.h