[CMake] With gcc is __FILE__ with full path. Is there a workaround?

Manfred Rebentisch mrebentisch at comparat.de
Sun Apr 1 15:59:49 EDT 2007


Hello,
another effect. In the past I compiled projects with gcc in the actual 
directory, the source file was "mysource.c". But with the generated cmake 
Makefile it is "/home/mareb/sb/cp/bkupserver/src/mysource.c". 
Into Logfiles I write for example with syslog(LOG_INFO, "%s: abcdef", 
__FILE__) and I do not like the long path.

Is there a way to go the following way?
1) change to source dir
2) call then gcc with source file without path
3) [may return to project dir.]

Or the possible easier way:
1) use relative paths from working (project) directory


Manfred



More information about the CMake mailing list