PostgreSQL native library for Tarantool programming language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindTarantool.cmake 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Define GNU standard installation directories
  2. include(GNUInstallDirs)
  3. macro(extract_definition name output input)
  4. string(REGEX MATCH "#define[\t ]+${name}[\t ]+\"([^\"]*)\""
  5. _t "${input}")
  6. string(REGEX REPLACE "#define[\t ]+${name}[\t ]+\"(.*)\"" "\\1"
  7. ${output} "${_t}")
  8. endmacro()
  9. find_path(TARANTOOL_INCLUDE_DIR tarantool/module.h
  10. HINTS ${TARANTOOL_DIR} ENV TARANTOOL_DIR
  11. PATH_SUFFIXES include
  12. )
  13. if(TARANTOOL_INCLUDE_DIR)
  14. set(_config "-")
  15. file(READ "${TARANTOOL_INCLUDE_DIR}/tarantool/module.h" _config0)
  16. string(REPLACE "\\" "\\\\" _config ${_config0})
  17. unset(_config0)
  18. extract_definition(PACKAGE_VERSION TARANTOOL_VERSION ${_config})
  19. extract_definition(INSTALL_PREFIX _install_prefix ${_config})
  20. unset(_config)
  21. endif()
  22. include(FindPackageHandleStandardArgs)
  23. find_package_handle_standard_args(TARANTOOL
  24. REQUIRED_VARS TARANTOOL_INCLUDE_DIR VERSION_VAR TARANTOOL_VERSION)
  25. if(TARANTOOL_FOUND)
  26. set(TARANTOOL_INCLUDE_DIRS "${TARANTOOL_INCLUDE_DIR}"
  27. "${TARANTOOL_INCLUDE_DIR}/tarantool/"
  28. CACHE PATH "Include directories for Tarantool")
  29. set(TARANTOOL_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/tarantool"
  30. CACHE PATH "Directory for storing Lua modules written in Lua")
  31. set(TARANTOOL_INSTALL_LUADIR "${CMAKE_INSTALL_DATADIR}/tarantool"
  32. CACHE PATH "Directory for storing Lua modules written in C")
  33. if (NOT TARANTOOL_FIND_QUIETLY AND NOT FIND_TARANTOOL_DETAILS)
  34. set(FIND_TARANTOOL_DETAILS ON CACHE INTERNAL "Details about TARANTOOL")
  35. message(STATUS "Tarantool LUADIR is ${TARANTOOL_INSTALL_LUADIR}")
  36. message(STATUS "Tarantool LIBDIR is ${TARANTOOL_INSTALL_LIBDIR}")
  37. endif ()
  38. endif()
  39. mark_as_advanced(TARANTOOL_INCLUDE_DIRS TARANTOOL_INSTALL_LIBDIR
  40. TARANTOOL_INSTALL_LUADIR)