release 1.1.1
[awesomized/libmemcached] / src / libhashkit / CMakeLists.txt
1 set(libhashkit_sources
2 aes.cc
3 algorithm.cc
4 common.h
5 crc32.cc
6 digest.cc
7 encrypt.cc
8 fnv_32.cc
9 fnv_64.cc
10 function.cc
11 has.cc
12 hashkit.cc
13 hsieh.cc
14 jenkins.cc
15 md5.cc
16 murmur.cc
17 murmur3.cc
18 murmur3_api.cc
19 one_at_a_time.cc
20 rijndael.cc
21 str_algorithm.cc
22 strerror.cc
23 string.cc
24 )
25 add_library(libhashkit SHARED)
26 add_library(hashkit ALIAS libhashkit)
27 set_target_properties(libhashkit PROPERTIES
28 CXX_STANDARD ${CXX_STANDARD}
29 LIBRARY_OUTPUT_NAME hashkit
30 LIBRARY_OUTPUT_NAME_DEBUG hashkit-dbg
31 SOVERSION ${LIBHASHKIT_SO_SOVERSION}
32 VERSION ${LIBHASHKIT_SO_VERSION})
33 target_compile_options(libhashkit PRIVATE -DBUILDING_HASHKIT)
34 target_include_directories(libhashkit PRIVATE
35 ${CMAKE_SOURCE_DIR}/src
36 ${CMAKE_BINARY_DIR}/src
37 ${CMAKE_BINARY_DIR})
38 target_include_directories(libhashkit PUBLIC
39 $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
40 $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
41 $<INSTALL_INTERFACE:include>)
42
43 if(ENABLE_OPENSSL_CRYPTO)
44 find_package(OpenSSL)
45 if(OPENSSL_FOUND)
46 if(OPENSSL_CRYPTO_LIBRARY)
47 target_compile_definitions(libhashkit PRIVATE HAVE_OPENSSL_CRYPTO)
48 target_link_libraries(libhashkit PUBLIC OpenSSL::Crypto)
49 pkgconfig_export(REQUIRES_PRIVATE libcrypto)
50 else()
51 message(WARNING "Could not find OpenSSL::Crypto")
52 endif()
53 endif()
54 endif()
55
56 configure_file(hashkitcon.h.in hashkitcon.h @ONLY)
57
58 install(TARGETS libhashkit EXPORT libhashkit-targets
59 RUNTIME COMPONENT bin DESTINATION ${CMAKE_INSTALL_BINDIR}
60 ARCHIVE COMPONENT lib DESTINATION ${CMAKE_INSTALL_LIBDIR}
61 LIBRARY COMPONENT lib DESTINATION ${CMAKE_INSTALL_LIBDIR}
62 ${TARGET_NAMELINK_COMPONENT}
63 )
64 export(EXPORT libhashkit-targets NAMESPACE libmemcached::)
65 install(EXPORT libhashkit-targets NAMESPACE libmemcached::
66 COMPONENT dev
67 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
68
69 install_public_headers(
70 libhashkit
71
72 hashkit.h
73 )
74
75 target_sources(libhashkit PRIVATE
76 ${libhashkit_sources}
77 ${libhashkit_includes})