gbdev / rgbds

Rednex Game Boy Development System - An assembly toolchain for the Nintendo Game Boy and Game Boy Color
https://rgbds.gbdev.io
MIT License
1.33k stars 175 forks source link

CMakeLists does not freshen version when building #979

Closed ISSOtm closed 2 years ago

ISSOtm commented 2 years ago

src/version.c is treated as a normal dependency, and not re-built when the executable changes.

ISSOtm commented 2 years ago

Note that this blocks #981, since then version.c gets compiled as C but linked as C++, leading to link errors.

ISSOtm commented 2 years ago

The goal is to "port over" this line from the Makefile, and its equivalents:

https://github.com/gbdev/rgbds/blob/da66eeb40e8184a0306e09757e078c0c34ef0236/Makefile#L112

We pass version.c directly to the driver so that it always gets recompiled; however, in CMake, we declare it as a normal dependency, so it doesn't get updated:

https://github.com/gbdev/rgbds/blob/da66eeb40e8184a0306e09757e078c0c34ef0236/src/CMakeLists.txt#L12

(I guess the problem is also present in the Makefile if none of a program's source files get updated between two releases...)