AdventOfCode/01/src/CMakeLists.txt

18 lines
770 B
Text
Raw Normal View History

2024-12-01 17:53:56 +01:00
# Make an explicit list of all source files in `CMakeDemo_SRC`. This is important
# because CMake is not a build system: it is a build system generator. Suppose
# you add a file foo.cpp to src/ after running cmake .. . If you set
# `CMakeDemo_SRC` with `file(GLOB ... )`, this is not passed to the makefile;
# the makefile doesn't know that foo.cpp exists and will not re-run cmake. Your
# collaborator's builds will fail and it will be unclear why. Whether you use
# file(GLOB ...) or not, you will need to re-run cmake, but with an explicit
# file list, you know beforehand why your code isn't compiling.
set(SRC
main.c
)
# Form the full path to the source files...
PREPEND(SRC)
# ... and pass the variable to the parent scope.
set(SRC ${SRC} PARENT_SCOPE)