CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. # Component: redis
  17. #####################################################
  18. # Description:
  19. # ------------
  20. # Cmake Input File for redis
  21. #####################################################
  22. project(redis)
  23. if(REDIS)
  24. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/libhiredis.so.0.13
  25. COMMAND make dynamic
  26. COMMAND mv libhiredis.so ${PROJECT_BINARY_DIR}/libhiredis.so.0.13
  27. COMMAND make clean
  28. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/hiredis
  29. COMMENT Building hiredis c library)
  30. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/libhiredis.so
  31. COMMAND ln -sf libhiredis.so.0.13 libhiredis.so
  32. DEPENDS ${PROJECT_BINARY_DIR}/libhiredis.so.0.13
  33. WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
  34. add_custom_target(hiredis-build ALL
  35. DEPENDS ${PROJECT_BINARY_DIR}/libhiredis.so)
  36. install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${PROJECT_BINARY_DIR}\")")
  37. add_library(hiredis SHARED IMPORTED)
  38. set_property(TARGET hiredis PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/libhiredis.so)
  39. add_dependencies(hiredis hiredis-build)
  40. install(FILES
  41. ${PROJECT_BINARY_DIR}/libhiredis.so
  42. ${PROJECT_BINARY_DIR}/libhiredis.so.0.13
  43. DESTINATION ${LIB_DIR}
  44. PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  45. COMPONENT Runtime)
  46. install(FILES
  47. ${PROJECT_SOURCE_DIR}/hiredis/COPYING
  48. DESTINATION ${LIB_DIR}
  49. COMPONENT Runtime
  50. RENAME libhiredis.copywrite)
  51. set(
  52. SRCS
  53. redis.hpp
  54. redis.cpp)
  55. include_directories(
  56. ./../../system/include
  57. ./../../rtl/eclrtl
  58. ./../../rtl/include
  59. ./../../common/deftype
  60. ./../../system/jlib
  61. ./hiredis)
  62. add_definitions(-D_USRDLL -DECL_REDIS_EXPORTS)
  63. HPCC_ADD_LIBRARY(redis SHARED ${SRCS})
  64. if(${CMAKE_VERSION} VERSION_LESS "2.8.9")
  65. message(WARNING "Cannot set NO_SONAME. shlibdeps will give warnings when package is installed")
  66. elseif(NOT APPLE)
  67. set_target_properties(redis PROPERTIES NO_SONAME 1)
  68. endif()
  69. install(
  70. TARGETS redis
  71. DESTINATION plugins)
  72. target_link_libraries(
  73. redis
  74. eclrtl
  75. jlib
  76. hiredis)
  77. endif()
  78. if(PLATFORM OR CLIENTTOOLS_ONLY)
  79. install(
  80. FILES ${CMAKE_CURRENT_SOURCE_DIR}/lib_redis.ecllib
  81. DESTINATION plugins
  82. COMPONENT Runtime)
  83. endif()