cmake_minimum_required(VERSION 3.0) # 项目名称和版本信息 project(GCC VERSION 11.2.0) # 源文件目录 set(SOURCE_DIR src) # 头文件目录 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) # 链接库 find_package(GMP REQUIRED) find_package(MPFR REQUIRED) find_package(MPC REQUIRED) find_package(ISL REQUIRED) find_package(CLOOG REQUIRED) find_package(ZLIB REQUIRED) # 添加源文件 file(GLOB SOURCES ${SOURCE_DIR}/*.c) add_executable(gcc ${SOURCES}) # 链接库 target_link_libraries(gcc GMP MPFR MPC ISL CLOOG ZLIB) # 安装目标 install(TARGETS gcc DESTINATION bin)