BuildSystem: Rework the whole cmake build system
Now files are installed using the install() command instead of manually copying files to their destinations. This allows automatic recompilation of headers that did not work previously
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023 CXX)
|
||||
|
||||
set(AOC2023_PROJECTS
|
||||
day1
|
||||
day2
|
||||
@@ -30,20 +26,21 @@ set(AOC2023_PROJECTS
|
||||
full
|
||||
)
|
||||
|
||||
set(BANAN_AOC2023_BIN ${BANAN_BIN}/aoc2023)
|
||||
set(BANAN_AOC2023_BIN ${CMAKE_INSTALL_BINDIR}/aoc2023)
|
||||
set(BANAN_AOC2023_INPUT ${BANAN_SHARE}/aoc2023)
|
||||
|
||||
set(CMAKE_INSTALL_BINDIR ${BANAN_AOC2023_BIN})
|
||||
|
||||
add_custom_target(aoc2023)
|
||||
add_custom_target(aoc2023_always
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_AOC2023_BIN}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_AOC2023_INPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input/* ${BANAN_AOC2023_INPUT}/
|
||||
)
|
||||
add_custom_target(aoc2023-install DEPENDS aoc2023 aoc2023_always)
|
||||
|
||||
file(GLOB_RECURSE input_files "input/*")
|
||||
foreach(file ${input_files})
|
||||
install(FILES ${file} DESTINATION ${BANAN_AOC2023_INPUT})
|
||||
endforeach()
|
||||
|
||||
foreach(AOC2023_PROJECT ${AOC2023_PROJECTS})
|
||||
add_subdirectory(${AOC2023_PROJECT})
|
||||
add_dependencies(aoc2023 aoc2023_${AOC2023_PROJECT})
|
||||
endforeach()
|
||||
|
||||
add_dependencies(userspace aoc2023)
|
||||
add_dependencies(userspace-install aoc2023-install)
|
||||
|
||||
Reference in New Issue
Block a user