aoc25/CMakeLists.txt
Feiko Wielsma eac8571ea7 Refactor CMake and VSCode settings; add Day 4 solution
- Updated .vscode/settings.json to enhance Clangd configuration and disable IntelliSense.
- Removed obsolete Clang-Format and Clang-Tidy tasks from .vscode/tasks.json.
- Modified CMakeLists.txt to enable compile commands export and adjusted target properties for Day 4.
- Added new CMakeLists.txt and main.cpp for Day 4 solution, implementing diagram parsing and movable paper counting logic.
- Included test_input and puzzle_input files for Day 4.
- Deleted the run-clang-tidy.sh script as it is no longer needed.
2025-12-04 14:22:43 +00:00

41 lines
1.2 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)