24 lines
691 B
CMake
24 lines
691 B
CMake
# src/ 子目录构建脚本:各子目录独立维护 CMakeLists.txt,并在此聚合链接
|
||
|
||
add_subdirectory(utils)
|
||
add_subdirectory(ast)
|
||
add_subdirectory(sem)
|
||
add_subdirectory(ir)
|
||
add_subdirectory(frontend)
|
||
add_subdirectory(irgen)
|
||
add_subdirectory(mir)
|
||
|
||
# 当前仓库仍是“骨架阶段”,`src/main.cpp` 暂无可链接的 main。
|
||
# 为了让默认 `cmake --build` 能成功(先把各模块库编译通过),将可执行文件从 ALL 中排除;
|
||
# 需要构建可执行文件时可显式执行:cmake --build <build_dir> --target compiler
|
||
add_executable(compiler EXCLUDE_FROM_ALL
|
||
main.cpp
|
||
)
|
||
target_link_libraries(compiler PRIVATE
|
||
frontend
|
||
sem
|
||
irgen
|
||
mir
|
||
utils
|
||
)
|