FindLibM.cmake 893 B

12345678910111213141516171819202122232425262728
  1. # LIBM_INCLUDE_DIRS - where to find math.h, etc.
  2. # LIBM_LIBRARIES - List of libraries when using libm.
  3. # LIBM_FOUND - True if math library found.
  4. #
  5. # Hints
  6. # ^^^^^
  7. #
  8. # A user may set ``LIBM_ROOT`` to a math library installation root to tell this
  9. # module where to look.
  10. find_path(LIBM_INCLUDE_DIRS
  11. NAMES math.h
  12. PATHS /usr/include /usr/local/include /usr/local/bic/include
  13. NO_DEFAULT_PATH
  14. )
  15. find_library(LIBM_LIBRARIES m)
  16. include(FindPackageHandleStandardArgs)
  17. find_package_handle_standard_args(LibM DEFAULT_MSG LIBM_LIBRARIES LIBM_INCLUDE_DIRS)
  18. mark_as_advanced(LIBM_INCLUDE_DIRS LIBM_LIBRARIES)
  19. if(LIBM_FOUND)
  20. if(NOT TARGET LIBM::LIBM)
  21. add_library(LIBM::LIBM UNKNOWN IMPORTED)
  22. set_target_properties(LIBM::LIBM PROPERTIES
  23. IMPORTED_LOCATION "${LIBM_LIBRARIES}"
  24. INTERFACE_INCLUDE_DIRECTORIES "${LIBM_INCLUDE_DIRS}")
  25. endif()
  26. endif()