xref: /5.5.2/couchdb/src/snappy/CMakeLists.txt (revision 4bd0f4c5)
1CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/snappy.app.in
2               ${CMAKE_CURRENT_BINARY_DIR}/snappy.app)
3
4
5SET(COUCH_VIEW_SNAPPY_SRC snappy_nif.cc)
6SET(COUCH_SNAPPY_VERSION "1.0.4")
7SET(COUCH_SNAPPY_PREFIX ${CMAKE_ERL_LIB_INSTALL_PREFIX}/snappy-${COUCH_SNAPPY_VERSION})
8SET(COUCH_SNAPPY_EBIN_PREFIX ${COUCH_SNAPPY_PREFIX}/ebin)
9SET(COUCH_SNAPPY_PRIV_PREFIX ${COUCH_SNAPPY_PREFIX}/priv)
10
11INCLUDE_DIRECTORIES(BEFORE ${SNAPPY_INCLUDE_DIR}
12                           ${ERLANG_INCLUDE_PATH})
13
14ADD_LIBRARY(snappy_nif MODULE ${COUCH_VIEW_SNAPPY_SRC})
15SET_TARGET_PROPERTIES(snappy_nif PROPERTIES PREFIX "")
16TARGET_LINK_LIBRARIES(snappy_nif ${COUCHBASE_UNRESOLVED}
17                                 ${SNAPPY_LIBRARIES}
18                                 ${COUCHBASE_MATH_LIBS})
19
20SET_TARGET_PROPERTIES(snappy_nif PROPERTIES
21    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/priv"
22    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/priv"
23)
24
25IF (APPLE)
26    # map from lib/couchdb/erlang/lib/snappy-1.0.4/priv/ to lib/
27    SET_TARGET_PROPERTIES(snappy_nif PROPERTIES
28                          INSTALL_RPATH "@loader_path/../../../../..")
29ENDIF ()
30
31ERL_BUILD("snappy" snappy.erl)
32
33INSTALL(TARGETS snappy_nif
34        DESTINATION ${COUCH_SNAPPY_PRIV_PREFIX})
35
36INSTALL(FILES ${outfiles}
37              ${CMAKE_CURRENT_BINARY_DIR}/snappy.app
38        DESTINATION ${COUCH_SNAPPY_EBIN_PREFIX})
39