2
0

FindGMP.cmake 815 B

123456789101112131415161718192021222324252627
  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. else()
  14. message (STATUS "Detecting GMP from system disabled! (ENABLE_SYSTEM_GMP=0)")
  15. endif()
  16. if(NOT USE_SYSTEM_GMP)
  17. message(STATUS "Using bundled mini-gmp library.")
  18. set(GMP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/gmp)
  19. set(GMP_LIBRARY gmp)
  20. add_subdirectory(lib/gmp)
  21. endif()
  22. include(FindPackageHandleStandardArgs)
  23. find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARY GMP_INCLUDE_DIR)