Skip to content

Commit

Permalink
Use pkg-config if available
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Richardson <[email protected]>
Signed-off-by: Tim Hutt <[email protected]>
  • Loading branch information
Timmmm and arichardson authored Jan 2, 2025
1 parent 9ea278c commit a3db21e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/modules/FindGMP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,34 @@
# GMP_CXX_LIBRARIES - LIST:The libraries needed to use GMP via it's C++ interface

include(FindPackageHandleStandardArgs)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_GMP QUIET gmp)
pkg_check_modules(PC_GMPXX QUIET gmpxx)
endif()

# Try to find libraries
find_library(GMP_C_LIBRARIES
NAMES gmp
PATHS ${PC_GMP_LIBRARY_DIRS}
DOC "GMP C libraries"
)
find_library(GMP_CXX_LIBRARIES
NAMES gmpxx
PATHS ${PC_GMPXX_LIBRARY_DIRS}
DOC "GMP C++ libraries"
)

# Try to find headers
find_path(GMP_C_INCLUDES
NAMES gmp.h
PATHS ${PC_GMP_INCLUDE_DIRS}
DOC "GMP C header"
)

find_path(GMP_CXX_INCLUDES
NAMES gmpxx.h
PATHS ${PC_GMPXX_INCLUDE_DIRS}
DOC "GMP C++ header"
)

Expand Down

0 comments on commit a3db21e

Please sign in to comment.