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.

56 lines
1.9 KiB

  1. # FindGMP.cmake can be found at https://code.google.com/p/origin/source/browse/trunk/cmake/FindGMP.cmake
  2. # Copyright (c) 2008-2010 Kent State University
  3. # Copyright (c) 2011-2012 Texas A&M University
  4. #
  5. # This file is distributed under the MIT License. See the accompanying file
  6. # LICENSE.txt or http://www.opensource.org/licenses/mit-license.php for terms
  7. # and conditions.
  8. # Modified by David Korzeniewski to also find MPIR as an alternative.
  9. # FIXME: How do I find the version of GMP that I want to use?
  10. # What versions are available?
  11. # NOTE: GMP prefix is understood to be the path to the root of the GMP
  12. # installation library.
  13. set(GMP_PREFIX "" CACHE PATH "The path to the prefix of a GMP installation")
  14. find_path(GMP_INCLUDE_DIR gmp.h
  15. PATHS ${GMP_PREFIX}/include /usr/include /usr/local/include)
  16. find_library(GMP_LIBRARY NAMES gmp
  17. PATHS ${GMP_PREFIX}/lib /usr/lib /usr/local/lib)
  18. find_library(GMP_MPIR_LIBRARY NAMES mpir
  19. PATHS ${GMP_PREFIX}/lib /usr/lib /usr/local/lib)
  20. find_library(GMP_MPIRXX_LIBRARY NAMES mpirxx
  21. PATHS ${GMP_PREFIX}/lib /usr/lib /usr/local/lib)
  22. if(GMP_INCLUDE_DIR AND GMP_LIBRARY)
  23. get_filename_component(GMP_LIBRARY_DIR ${GMP_LIBRARY} PATH)
  24. set(GMP_FOUND TRUE)
  25. endif()
  26. if(GMP_INCLUDE_DIR AND GMP_MPIR_LIBRARY AND GMP_MPIRXX_LIBRARY)
  27. get_filename_component(GMP_MPIR_LIBRARY_DIR ${GMP_MPIR_LIBRARY} PATH)
  28. get_filename_component(GMP_MPIRXX_LIBRARY_DIR ${GMP_MPIRXX_LIBRARY} PATH)
  29. set(MPIR_FOUND TRUE)
  30. endif()
  31. if(GMP_FOUND)
  32. if(NOT GMP_FIND_QUIETLY)
  33. MESSAGE(STATUS "Found GMP: ${GMP_LIBRARY}")
  34. endif()
  35. elseif(MPIR_FOUND)
  36. if(NOT GMP_FIND_QUIETLY)
  37. MESSAGE(STATUS "Found GMP alternative MPIR: ${GMP_MPIR_LIBRARY} and ${GMP_MPIRXX_LIBRARY}")
  38. endif()
  39. elseif(GMP_FOUND)
  40. if(GMP_FIND_REQUIRED)
  41. message(FATAL_ERROR "Could not find GMP")
  42. endif()
  43. endif()
  44. MARK_AS_ADVANCED(GMP_MPIRXX_LIBRARY GMP_MPIR_LIBRARY GMP_INCLUDE_DIR GMP_LIBRARY)