cmake 未找到 GMP 和 MPFR,但已安装

use*_*925 5 macos boost cmake mpfr gmp

我正在尝试在 mac os X 10.11 上编译需要 boost、GMP 和 MPFR 的 plll 库。

我已经通过自制软件安装了 boost、GMP 和 MPFR,然后我在 plll 中的目录构建中启动了 cmake,但是我得到了那个错误:

 By not providing "FindMPFR.cmake" in CMAKE_MODULE_PATH this project has
 asked CMake to find a package configuration file provided by "MPFR", but
 CMake did not find one.

 Could not find a package configuration file provided by "MPFR" with any of
the following names:

MPFRConfig.cmake
mpfr-config.cmake

Add the installation prefix of "MPFR" to CMAKE_PREFIX_PATH or set
"MPFR_DIR" to a directory containing one of the above files.  If "MPFR"
provides a separate development package or SDK, be sure it has been
installed.
Run Code Online (Sandbox Code Playgroud)

如果我更改 cmake 使用的 Librairies.txt 中 GMP 和 MPFR 的顺序,则 GMP 也是如此。

之后我手动安装了库,它们在/usr/local/include 中。GMP的make检查是完美的,所以我猜安装没问题。

但仍然是同样的错误信息。我还尝试添加 FindMPFR.cmake 文件,但根本没有任何更改。

以下是 Libraries.txt 的相关部分:

find_package(MPFR REQUIRED)
include_directories(${MPFR_INCLUDES})
if(NOT MPFR_FOUND)
    message(FATAL_ERROR "Could not find MPFR!")
endif(NOT MPFR_FOUND)
set(libraries ${libraries} ${MPFR_LIBRARIES})
set(libraries_shared ${libraries_shared} ${MPFR_LIBRARIES})

find_package(GMP REQUIRED)
include_directories(${GMP_INCLUDE_DIR})
if(NOT (GMP_INCLUDE_DIR AND GMP_LIBRARIES))
    message(FATAL_ERROR "Could not find GMP!")
endif(NOT (GMP_INCLUDE_DIR AND GMP_LIBRARIES))
set(libraries ${libraries} ${GMP_LIBRARIES})
set(libraries_shared ${libraries_shared} ${GMP_LIBRARIES})
Run Code Online (Sandbox Code Playgroud)

奇怪的是,我对 Boost 没有任何问题......