- mkdir build
script:
- - cmake -B build -S . -DCMAKE_BUILD_TYPE=${BUILD}
+ - cd build && cmake -DCMAKE_BUILD_TYPE=${BUILD} ..
- make -C build
- make -C build test
+function(to_hex HEX)
+ set(XNUMBER 0x)
+ set(XDIGITS 0 1 2 3 4 5 6 7 8 9 a b c d e f)
+ foreach(DEC IN LISTS ARGN)
+ if(${DEC} GREATER 255)
+ message(WARNING "to_hex(HEX ${DEC}): decimal number out of uint8 range (>=256)")
+ endif()
+ math(EXPR HIDEC "${DEC} / 16")
+ math(EXPR LODEC "${DEC} % 16")
+ list(GET XDIGITS ${HIDEC} HIHEX)
+ list(GET XDIGITS ${LODEC} LOHEX)
+ string(APPEND XNUMBER ${HIHEX}${LOHEX})
+ endforeach()
+ set(${HEX} ${XNUMBER} PARENT_SCOPE)
+endfunction()
set(LIBMEMCACHED_VERSION_MAJOR 1)
set(LIBMEMCACHED_VERSION_MINOR 0)
set(LIBMEMCACHED_VERSION_PATCH 99)
set(LIBMEMCACHED_VERSION ${LIBMEMCACHED_VERSION_MAJOR}.${LIBMEMCACHED_VERSION_MINOR}.${LIBMEMCACHED_VERSION_PATCH})
-
-set(LIBMEMCACHED_VERSION_HEX)
-math(EXPR LIBMEMCACHED_VERSION_HEX "(${LIBMEMCACHED_VERSION_MAJOR}<<16) + (${LIBMEMCACHED_VERSION_MINOR}<<8) + ${LIBMEMCACHED_VERSION_PATCH}+0"
- OUTPUT_FORMAT HEXADECIMAL)
+to_hex(LIBMEMCACHED_VERSION_HEX ${LIBMEMCACHED_VERSION_MAJOR} ${LIBMEMCACHED_VERSION_MINOR} ${LIBMEMCACHED_VERSION_PATCH})
set(LIBMEMCACHED_SO_VERSION_CUR 12)
set(LIBMEMCACHED_SO_VERSION_REV 0)
set(LIBHASHKIT_VERSION_PATCH 0)
set(LIBHASHKIT_VERSION ${LIBHASHKIT_VERSION_MAJOR}.${LIBHASHKIT_VERSION_MINOR}.${LIBHASHKIT_VERSION_PATCH})
-
-set(LIBHASHKIT_VERSION_HEX)
-math(EXPR LIBHASHKIT_VERSION_HEX "(${LIBHASHKIT_VERSION_MAJOR}<<16) + (${LIBHASHKIT_VERSION_MINOR}<<8) + ${LIBHASHKIT_VERSION_PATCH}+0"
- OUTPUT_FORMAT HEXADECIMAL)
+to_hex(LIBHASHKIT_VERSION_HEX ${LIBHASHKIT_VERSION_MAJOR} ${LIBHASHKIT_VERSION_MINOR} ${LIBHASHKIT_VERSION_PATCH})
set(LIBHASHKIT_SO_VERSION_CUR 2)
set(LIBHASHKIT_SO_VERSION_REV 0)
add_executable(${CLIENT} ${CLIENT}.cc)
target_include_directories(${CLIENT} PRIVATE ..)
target_link_libraries(${CLIENT} libclient_utilities)
- install(TARGETS ${CLIENT})
+ install(TARGETS ${CLIENT}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endforeach()
# extra sources
ms_conn.c ms_setting.c ms_sigsegv.c ms_stats.c ms_task.c ms_thread.c)
target_include_directories(memaslap PRIVATE .. ${LIBEVENT_INCLUDEDIR})
target_link_libraries(memaslap libclient_utilities ${LIBEVENT_LIBRARIES} Threads::Threads)
- install(TARGETS memaslap)
+ install(TARGETS memaslap
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
configure_file(configure.h.in configure.h @ONLY)
install(DIRECTORY ../libhashkit-1.0
- TYPE INCLUDE
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING REGEX "\\.h(pp)?$"
)
configure_file(hashkitcon.h.in hashkitcon.h @ONLY)
set_target_properties(libhashkit PROPERTIES SOVERSION ${LIBHASHKIT_SO_VERSION})
-install(TARGETS libhashkit EXPORT libhashkit)
+install(TARGETS libhashkit EXPORT libhashkit
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT libhashkit)
install(EXPORT libhashkit DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- TYPE INCLUDE
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN hashkit.h
)
configure_file(configure.h.in configure.h @ONLY)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- TYPE INCLUDE
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING REGEX "\\.h(pp)?$"
PATTERN t EXCLUDE
)
target_compile_definitions(libmemcached PRIVATE -DBUILDING_LIBMEMCACHED)
set_target_properties(libmemcached PROPERTIES SOVERSION ${LIBMEMCACHED_SO_VERSION})
-install(TARGETS libmemcached EXPORT libmemcached)
+install(TARGETS libmemcached EXPORT libmemcached
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT libmemcached)
install(EXPORT libmemcached DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- TYPE INCLUDE
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING REGEX "(memcached|util)\\.h(pp)?"
PATTERN csl EXCLUDE
PATTERN memcached EXCLUDE
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- TYPE INCLUDE
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING REGEX "\\.h(pp)?$"
)
target_link_libraries(libmemcachedutil libmemcached Threads::Threads)
set_target_properties(libmemcachedutil PROPERTIES SOVERSION ${LIBMEMCACHEDUTIL_SO_VERSION})
-install(TARGETS libmemcachedutil EXPORT libmemcachedutil)
+install(TARGETS libmemcachedutil EXPORT libmemcachedutil
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
export(EXPORT libmemcachedutil)
install(EXPORT libmemcachedutil DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake)