FindEth.cmake 2.3 KB

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