aoc25/CMakeLists.txt
Feiko Wielsma 9a3e228f00 Add day 8 implementation with input parsing and distance calculations
- Created CMakeLists.txt for day 8 and added it to the main CMakeLists.txt.
- Implemented main.cpp for day 8, including functions for parsing input, calculating distances, and processing point combinations.
- Added test and puzzle input files for day 8.
2025-12-09 22:38:06 +00:00

46 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.10.0)
# Set compilers before project() to ensure they're used
set(CMAKE_C_COMPILER /usr/bin/clang-21)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-21)
project(aoc25 VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Helper to add AoC day targets and auto-copy any input files
function(aoc_add_day name src_dir)
# remaining args are source files
set(sources ${ARGN})
add_executable(${name} ${sources})
set_target_properties(${name} PROPERTIES CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
target_compile_options(${name} PRIVATE -stdlib=libc++)
target_link_options(${name} PRIVATE -stdlib=libc++)
# Gather common input files in the source directory
file(GLOB INPUT_FILES
"${src_dir}/*_input"
"${src_dir}/puzzle_input"
"${src_dir}/test_input"
)
foreach(f IN LISTS INPUT_FILES)
get_filename_component(fname ${f} NAME)
add_custom_command(TARGET ${name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${f} $<TARGET_FILE_DIR:${name}>/${fname}
COMMENT "Copying ${fname} to build directory for ${name}"
)
endforeach()
endfunction()
# Per-day subprojects (example: day1)
add_subdirectory(day1)
add_subdirectory(day2)
add_subdirectory(day3)
add_subdirectory(day4)
add_subdirectory(day5)
add_subdirectory(day6)
add_subdirectory(day7)
add_subdirectory(day8)