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

Filipe Sousa natros at gmail.com
Mon Apr 2 16:56:11 EDT 2007


Eric Noulard wrote:
> 2007/4/2, Manfred Rebentisch <mrebentisch at comparat.de>:
> 
> May be.
> 
> May be you can use predefined
>  C99  __func__ or GCC specific __FUNCTION__ macros
> and then you should be able to use:
> 
> printf("%s:%s error msg x\n", basename(__FILE__), __FUNCTION__);
> 
> nevertheless my man page says that basename could modify
> its argument which may gives you unexpected result in this case...

@google:
#define FILE ((strrchr(__FILE__, '/') ? : __FILE__- 1) + 1)

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/20070402/3264206d/signature.pgp


More information about the CMake mailing list