Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
cmake_minimum_required(VERSION 3.1)
project(Snappy VERSION 1.1.7 LANGUAGES C CXX)

set(SNAPPY_VER 1.1.7)

project(Snappy VERSION ${SNAPPY_VER} LANGUAGES C CXX)

# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
# it prominent in the GUI.
option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)

option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)

set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")

include(TestBigEndian)
test_big_endian(SNAPPY_IS_BIG_ENDIAN)

Expand Down Expand Up @@ -52,6 +57,10 @@ configure_file(
"${PROJECT_BINARY_DIR}/config.h"
)

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/snappy.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/snappy.pc")

# We don't want to define HAVE_ macros in public headers. Instead, we use
# CMake's variable substitution with 0/1 variables, which will be seen by the
# preprocessor as constants.
Expand Down Expand Up @@ -172,3 +181,6 @@ install(
"${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy"
)

install(FILES ${PROJECT_BINARY_DIR}/snappy.pc
DESTINATION ${INSTALL_PKGCONFIG_DIR})
10 changes: 10 additions & 0 deletions cmake/snappy.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/lib

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really use include(GNUInstallDirs) and not hardcode lib.

includedir=$@CMAKE_INSTALL_PREFIX@/include

Name: snappy
Description: Fast compressor/decompressor library.
Version: @SNAPPY_VER@
Libs: -L@CMAKE_INSTALL_PREFIX@/lib -lsnappy
Cflags: -I@CMAKE_INSTALL_PREFIX@/include