cmake: 3.12 compatibility
authorMichael Wallner <mike@php.net>
Thu, 6 Feb 2020 15:34:58 +0000 (16:34 +0100)
committerMichael Wallner <mike@php.net>
Thu, 6 Feb 2020 15:55:09 +0000 (16:55 +0100)
.travis.yml
CMakeVersions.txt
clients/CMakeLists.txt
libhashkit-1.0/CMakeLists.txt
libhashkit/CMakeLists.txt
libmemcached-1.0/CMakeLists.txt
libmemcached/CMakeLists.txt
libmemcachedutil-1.0/CMakeLists.txt
libmemcachedutil/CMakeLists.txt

index f24bf6050670e9940dd56b191b62bbd7dc4e4b1c..d6d8085dfda750163350b4b65e558c0247a858ba 100644 (file)
@@ -27,7 +27,7 @@ before_script:
  - 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
 
index 683f43e7c0aee876531d0d4f57bfee1423e230b6..8f689ee2ae9f35b976e790e08ad1c921dcdeb603 100644 (file)
@@ -1,13 +1,25 @@
+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)
@@ -32,10 +44,7 @@ set(LIBHASHKIT_VERSION_MINOR 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)
index 25815a54e8497fa936d2cc5c4737ccc4a37fa234..b7815db11a98f1819fd44303a36c8ba890b354f4 100644 (file)
@@ -8,7 +8,8 @@ foreach(CLIENT IN LISTS CLIENTS)
     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
@@ -29,6 +30,7 @@ if(ENABLE_MEMASLAP)
                 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()
index d4fb6a4906b20c6766af7c38ecfbabca6fd80dfb..7fc72a3c5eec945bb4d31f1715925d6f452e5ef1 100644 (file)
@@ -2,6 +2,6 @@
 configure_file(configure.h.in configure.h @ONLY)
 
 install(DIRECTORY ../libhashkit-1.0
-        TYPE INCLUDE
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
         FILES_MATCHING REGEX "\\.h(pp)?$"
         )
index b9b500f0486a526cc2462e51de957f87fc13e450..646ffd3f57a9864e30a6c4a4505378429e64e520 100644 (file)
@@ -38,10 +38,11 @@ target_compile_options(libhashkit PRIVATE -DBUILDING_HASHKIT)
 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
         )
index 094cffb29ebb1de515d7a21cca5916db0196720a..061c6f7fd374030bc17142ee47ec1e117a45141e 100644 (file)
@@ -2,7 +2,7 @@
 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
         )
index 19f93a99296e4a7af780a6b7327c9ad564e6302f..2f8b0183cd6051178c7a5098740d6d778e543c4f 100644 (file)
@@ -72,12 +72,13 @@ target_include_directories(libmemcached PRIVATE .. ${LIBSASL_INCLUDEDIR})
 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
index c74a64920beb248c3c3a34348d3f7057958cecff..c61388753c8b5d96f0df7b736339d0a057d00551 100644 (file)
@@ -1,5 +1,5 @@
 
 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        TYPE INCLUDE
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
         FILES_MATCHING REGEX "\\.h(pp)?$"
         )
index 1cc32fe3f6cfb0a2f03d9f668f2f1160e90555ec..6ef3a7560d8398c850793c25dd587138ab10e79e 100644 (file)
@@ -14,6 +14,7 @@ target_compile_definitions(libmemcachedutil PRIVATE -DBUILDING_LIBMEMCACHED)
 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)