c213e270fab4155ed7ed9b4a688c8f620f601bbe
[awesomized/libmemcached] / src / libmemcachedprotocol / CMakeLists.txt
1 check_include(umem.h)
2
3 set(libmemcachedprotocol_sources
4 ascii_handler.c
5 binary_handler.c
6 cache.c
7 common.h
8 handler.c
9 pedantic.c
10 ../libmemcached/byteorder.cc
11 )
12 add_library(libmemcachedprotocol)
13 add_library(memcachedprotocol ALIAS libmemcachedprotocol)
14 set_target_properties(libmemcachedprotocol PROPERTIES
15 CXX_STANDARD ${CXX_STANDARD}
16 OUTPUT_NAME memcachedprotocol
17 OUTPUT_NAME_DEBUG memcachedprotocol-dbg
18 SOVERSION ${LIBMEMCACHEDPROTOCOL_SO_SOVERSION}
19 VERSION ${LIBMEMCACHEDPROTOCOL_SO_VERSION})
20 target_compile_definitions(libmemcachedprotocol PRIVATE -DBUILDING_LIBMEMCACHED)
21 if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
22 set_target_properties(libmemcachedprotocol PROPERTIES
23 LINK_FLAGS "-Wl,-undefined,dynamic_lookup"
24 )
25 endif()
26 target_link_libraries(libmemcachedprotocol PRIVATE p9y)
27 target_link_libraries(libmemcachedprotocol PUBLIC Threads::Threads)
28 if(MSVC OR MINGW)
29 target_link_libraries(libmemcachedprotocol PUBLIC wsock32 ws2_32)
30 endif()
31 target_include_directories(libmemcachedprotocol PRIVATE
32 ${CMAKE_SOURCE_DIR}/src
33 ${CMAKE_BINARY_DIR}/src
34 ${CMAKE_BINARY_DIR})
35 target_include_directories(libmemcachedprotocol PUBLIC
36 $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
37 $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
38 $<INSTALL_INTERFACE:include>)
39
40 install(TARGETS libmemcachedprotocol EXPORT libmemcachedprotocol-targets
41 RUNTIME COMPONENT bin DESTINATION ${CMAKE_INSTALL_BINDIR}
42 ARCHIVE COMPONENT lib DESTINATION ${CMAKE_INSTALL_LIBDIR}
43 LIBRARY COMPONENT lib DESTINATION ${CMAKE_INSTALL_LIBDIR}
44 ${TARGET_NAMELINK_COMPONENT}
45 )
46 export(EXPORT libmemcachedprotocol-targets NAMESPACE libmemcached::)
47 install(EXPORT libmemcachedprotocol-targets NAMESPACE libmemcached::
48 COMPONENT dev
49 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
50
51 target_sources(libmemcachedprotocol PRIVATE
52 ${libmemcachedprotocol_sources}
53 ${libmemcachedprotocol_includes}
54 )