diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f534b1..db2e626 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ 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. @@ -7,6 +10,8 @@ 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) @@ -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. @@ -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}) diff --git a/cmake/snappy.pc.in b/cmake/snappy.pc.in new file mode 100644 index 0000000..81f2ac1 --- /dev/null +++ b/cmake/snappy.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_PREFIX@/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