cmake_minimum_required(VERSION 3.0) # 项目名称和版本信息 project(MPFR VERSION 4.1.0) # 源文件目录 set(SOURCE_DIR src) # 头文件目录 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) # 链接库 find_package(GMP REQUIRED) # 添加源文件 file(GLOB SOURCES ${SOURCE_DIR}/*.c) add_library(mpfr STATIC ${SOURCES}) # 链接库 target_link_libraries(mpfr GMP) # 安装目标 install(TARGETS mpfr ARCHIVE DESTINATION lib) install(DIRECTORY include/mpfr.h DESTINATION include)