Feature request: CMAKE_USE_RELATIVE_PATHS should be supported again
I am facing the same problem as described in http://cmake.3232098.n2.nabble.com/CMAKE-USE-RELATIVE-PATHS-td4042914.html. Unfortunately, the suggested solution at the end of the page are not suitalbe for varios reasons:
Point 1. The gcc __BASE_FILE__
macro does not give the base name of the file in regard to the file system. Actually when __BASE_FILE__
occurs in a .h file it gives the .c file from where the header file is included.
Point 2. Calculating the base name at runtime has two draw backs:
- The full path is still stored as string literal in the binary which blows up firmware image. If you consider deeply embedded system this additional space required for the string literals matters.
- Building the project in a different directory and/or by a different user results in different firmware images - even the same compiler toolchain is used. The build depends on the location and therefore it is impossible to exactly reprouce a build (probably many years later).
So there are good reasons why someone might want to avoid the monstrosities __FILE__
name and the solution is to get CMAKE_USE_RELATIVE_PATHS working instead of removing it.
Edited by Brad King