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