xref: /6.0.3/tlm/deps/packages/snappy/CMakeLists.txt (revision 8bbe7c2d)
1# Downloads the declared version of libsnappy source code and builds it.
2
3include(ExternalProject)
4
5### Download, configure and build snappy ####################################
6ExternalProject_Add(snappy
7  GIT_REPOSITORY ${_git_repo}
8  GIT_TAG ${_git_rev}
9
10  CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
11                                           --enable-shared
12                                           --disable-static
13                                           --disable-dependency-tracking
14                                           --disable-gtest
15
16  BUILD_COMMAND $(MAKE) all
17
18  INSTALL_DIR ${CMAKE_BINARY_DIR}/install
19  INSTALL_COMMAND $(MAKE) install
20          COMMAND rm -rf <INSTALL_DIR>/share
21          COMMAND rm -f <INSTALL_DIR>/lib/libsnappy.la
22
23  COMMAND ${CMAKE_COMMAND} -E echo FILE "(COPY lib include DESTINATION \"\${CMAKE_INSTALL_PREFIX}\")" > <INSTALL_DIR>/CMakeLists.txt
24)
25
26# OS X-only: Custom post-build step to set the shared library install name.
27if (APPLE)
28  ExternalProject_Add_Step(snappy install_name
29    COMMAND install_name_tool -id @rpath/libsnappy.1.dylib <BINARY_DIR>/.libs/libsnappy.1.dylib
30    DEPENDEES build
31    DEPENDERS install
32    WORKING_DIRECTORY <BINARY_DIR>
33  )
34endif(APPLE)
35
36# cbdeps boilerplate
37_ADD_PACKAGE_STEP()
38