FindWeb3.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #------------------------------------------------------------------------------
  2. # CMake helper for libwhisper, libwebthree and libweb3jsonrpc.
  3. #
  4. # This module defines
  5. # Web3_XXX_LIBRARIES, the libraries needed to use ethereum.
  6. # TODO: Web3_INCLUDE_DIRS
  7. #
  8. # The documentation for cpp-ethereum is hosted at http://cpp-ethereum.org
  9. #
  10. # ------------------------------------------------------------------------------
  11. # This file is part of cpp-ethereum.
  12. #
  13. # cpp-ethereum is free software: you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation, either version 3 of the License, or
  16. # (at your option) any later version.
  17. #
  18. # cpp-ethereum is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>
  25. #
  26. # (c) 2014-2016 cpp-ethereum contributors.
  27. #------------------------------------------------------------------------------
  28. include(EthUtils)
  29. set(LIBS whisper;webthree;web3jsonrpc)
  30. set(Web3_INCLUDE_DIRS ${CPP_ETHEREUM_DIR})
  31. # if the project is a subset of cpp-ethereum
  32. # use same pattern for variables as Boost uses
  33. if ((DEFINED webthree_VERSION) OR (DEFINED cpp-ethereum_VERSION))
  34. foreach (l ${LIBS})
  35. string(TOUPPER ${l} L)
  36. set ("Web3_${L}_LIBRARIES" ${l})
  37. endforeach()
  38. else()
  39. foreach (l ${LIBS})
  40. string(TOUPPER ${l} L)
  41. find_library(Web3_${L}_LIBRARY
  42. NAMES ${l}
  43. PATHS ${CMAKE_LIBRARY_PATH}
  44. PATH_SUFFIXES "lib${l}" "${l}" "lib${l}/Release"
  45. NO_DEFAULT_PATH
  46. )
  47. set(Web3_${L}_LIBRARIES ${Web3_${L}_LIBRARY})
  48. if (MSVC)
  49. find_library(Web3_${L}_LIBRARY_DEBUG
  50. NAMES ${l}
  51. PATHS ${CMAKE_LIBRARY_PATH}
  52. PATH_SUFFIXES "lib${l}/Debug"
  53. NO_DEFAULT_PATH
  54. )
  55. eth_check_library_link(Web3_${L})
  56. endif()
  57. endforeach()
  58. endif()