include (TestBigEndian)
check_include_file_cxx (sys/mman.h HAVE_SYS_MMAN_H)
+check_include_file_cxx (sys/byteorder.h HAVE_SYS_BYTEORDER_H)
+check_include_file_cxx (sys/endian.h HAVE_SYS_ENDIAN_H)
+check_include_file_cxx (byteswap.h HAVE_BYTESWAP_H)
check_cxx_source_compiles (
"main() { return __builtin_expect(1, 1) ? 1 : 0; }"
add_definitions (-DHAVE_CONFIG_H)
+# Adjust warnings
+if (CMAKE_COMPILER_IS_GNUCXX)
+ add_definitions (-Wno-unused-function)
+endif ()
+
include_directories (${CMAKE_CURRENT_BINARY_DIR})
set_target_properties (snappy_bundled PROPERTIES
COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
)
+
+# If we're doing an out of source build remove any config.h from the source tree.
+if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
+ add_custom_command (
+ TARGET snappy_bundled
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_SOURCE_DIR}/config.h
+ )
+endif()