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

Filipe Sousa natros at gmail.com
Sun Apr 1 17:20:30 EDT 2007


Manfred Rebentisch wrote:
> 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

what about using basename()?

Filipe Sousa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20070401/722d903a/signature.pgp


More information about the CMake mailing list