File: FindMPFI.cmake

package info (click to toggle)
cgal 6.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (68 lines) | stat: -rw-r--r-- 1,998 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
find_package( GMP QUIET )
find_package( MPFR QUIET )

if( GMP_FOUND AND MPFR_FOUND )

  if( MPFI_INCLUDE_DIR AND MPFI_LIBRARIES )
    set( MPFI_FOUND TRUE )
  endif( MPFI_INCLUDE_DIR AND MPFI_LIBRARIES )

  find_path(MPFI_INCLUDE_DIR NAMES mpfi.h
            HINTS ENV MPFI_INC_DIR
                  ENV MPFI_DIR
            PATHS ${GMP_INCLUDE_DIR_SEARCH}
            PATH_SUFFIXES include
            DOC "The directory containing the MPFI header files"
           )

  find_library(MPFI_LIBRARIES NAMES mpfi
               HINTS ENV MPFI_LIB_DIR
                     ENV MPFI_DIR
               PATHS ${GMP_LIBRARIES_DIR_SEARCH}
               PATH_SUFFIXES lib
               DOC "Directory containing the MPFI library"
               )

  if( MPFI_LIBRARIES )
    get_filename_component(MPFI_LIBRARIES_DIR ${MPFI_LIBRARIES} PATH CACHE )
  endif( MPFI_LIBRARIES )

  if( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR )
    include( MPFIConfig OPTIONAL )
  endif( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR )

  include(FindPackageHandleStandardArgs)

  find_package_handle_standard_args( MPFI
                                     "DEFAULT_MSG"
                                     MPFI_LIBRARIES
                                     MPFI_INCLUDE_DIR )

else( GMP_FOUND AND MPFR_FOUND )

  message( STATUS "MPFI needs GMP and MPFR" )

endif( GMP_FOUND AND MPFR_FOUND )

if( MPFI_FOUND )
  get_dependency_version( MPFR )
  IS_VERSION_LESS("${MPFR_VERSION}" "4.0.0" _MPFR_OLD)

  get_dependency_version( MPFI )
  IS_VERSION_LESS("${MPFI_VERSION}" "1.5.2" _MPFI_OLD)

  if( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) )

    message(
      STATUS
      "MPFI<1.5.2 requires MPFR<4.0.0; MPFI>=1.5.2 requires MPFR>=4.0.0" )

    set( MPFI_FOUND FALSE )

  else( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) )

    set( MPFI_USE_FILE "CGAL_UseMPFI" )

  endif( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) )

endif( MPFI_FOUND )