FindGMP.cmake 730 B

12345678910111213141516171819202122232425
  1. option(ENABLE_SYSTEM_GMP "Use GMP from system" TRUE)
  2. mark_as_advanced(GMP_LIBRARY GMP_INCLUDE_DIR)
  3. set(USE_SYSTEM_GMP FALSE)
  4. if(ENABLE_SYSTEM_GMP)
  5. find_library(GMP_LIBRARY NAMES gmp)
  6. find_path(GMP_INCLUDE_DIR NAMES gmp.h)
  7. if(GMP_LIBRARY AND GMP_INCLUDE_DIR)
  8. message (STATUS "Using GMP provided by system.")
  9. set(USE_SYSTEM_GMP TRUE)
  10. else()
  11. message (STATUS "Detecting GMP from system failed.")
  12. endif()
  13. endif()
  14. if(NOT USE_SYSTEM_GMP)
  15. message(STATUS "Using bundled mini-gmp library.")
  16. set(GMP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/gmp)
  17. set(GMP_LIBRARY gmp)
  18. add_subdirectory(lib/gmp)
  19. endif()
  20. include(FindPackageHandleStandardArgs)
  21. find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARY GMP_INCLUDE_DIR)