# src/ 子目录构建脚本：各子目录独立维护 CMakeLists.txt，并在此聚合链接

add_subdirectory(utils)
add_subdirectory(ir)
add_subdirectory(frontend)
if(NOT COMPILER_PARSE_ONLY)
  add_subdirectory(sem)
  add_subdirectory(mir)
endif()

add_executable(compiler
  main.cpp
)
target_link_libraries(compiler PRIVATE
  frontend
  utils
)

if(NOT COMPILER_PARSE_ONLY)
  target_link_libraries(compiler PRIVATE
    sem
    mir
  )
  target_compile_definitions(compiler PRIVATE COMPILER_PARSE_ONLY=0)
else()
  target_compile_definitions(compiler PRIVATE COMPILER_PARSE_ONLY=1)
endif()
