Redo CMake configuration.

The style was changed to match the official manual [1], the install
configuration was simplified and now matches the official packaging
guide [2], and the config files use the CMake-specific variable syntax
${VAR} instead of the autoconf-compatible syntax @VAR@, as documented in
[3]. The public header files are declared as such (for CMake 3.3+), and
the generated headers are included in the library target definition.

The tests are only built if SNAPPY_BUILD_TESTS (default ON) is true, so
zippy can be easily used in projects that add_subdirectory() its source
code directly, instead of using find_package().

[1] https://cmake.org/cmake/help/git-master/manual/cmake-language.7.html
[2] https://cmake.org/cmake/help/git-master/manual/cmake-packages.7.html
[3] https://cmake.org/cmake/help/git-master/command/configure_file.html
This commit is contained in:
costan
2017-07-28 09:55:21 -07:00
committed by Victor Costan
parent e4de6ce087
commit be6dc3db83
6 changed files with 158 additions and 148 deletions

View File

@@ -36,21 +36,21 @@
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
#define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
#if @ac_cv_have_stdint_h@
#if ${HAVE_STDINT_H_01} // HAVE_STDINT_H
#include <stdint.h>
#endif
#endif // HAVE_STDDEF_H
#if @ac_cv_have_stddef_h@
#if ${HAVE_STDDEF_H_01} // HAVE_STDDEF_H
#include <stddef.h>
#endif
#endif // HAVE_STDDEF_H
#if @ac_cv_have_sys_uio_h@
#if ${HAVE_SYS_UIO_H_01} // HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#endif // HAVE_SYS_UIO_H
#define SNAPPY_MAJOR @SNAPPY_MAJOR@
#define SNAPPY_MINOR @SNAPPY_MINOR@
#define SNAPPY_PATCHLEVEL @SNAPPY_PATCHLEVEL@
#define SNAPPY_MAJOR ${SNAPPY_MAJOR}
#define SNAPPY_MINOR ${SNAPPY_MINOR}
#define SNAPPY_PATCHLEVEL ${SNAPPY_PATCHLEVEL}
#define SNAPPY_VERSION \
((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
@@ -58,7 +58,7 @@
namespace snappy {
#if @ac_cv_have_stdint_h@
#if ${HAVE_STDINT_H_01} // HAVE_STDINT_H
typedef int8_t int8;
typedef uint8_t uint8;
typedef int16_t int16;
@@ -76,18 +76,18 @@ typedef int int32;
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
#endif
#endif // HAVE_STDINT_H
typedef std::string string;
#if !@ac_cv_have_sys_uio_h@
#if !${HAVE_SYS_UIO_H_01} // !HAVE_SYS_UIO_H
// Windows does not have an iovec type, yet the concept is universally useful.
// It is simple to define it ourselves, so we put it inside our own namespace.
struct iovec {
void* iov_base;
size_t iov_len;
};
#endif
#endif // !HAVE_SYS_UIO_H
} // namespace snappy