2009/11/21 barcaroller <barcarol...@sympatico.ca>:
>
> "Eric Noulard" wrote:
>
>> What is the final reason that makes you want to avoid the "monstrosities"?
>
> I do not want the __FILE__ macro to reveal the structure of the project.
> Also, I'm trying to keep the log file entries short.
>
> I guess I can wrap __FILE__ with another macro that extracts relative
> pathnames, but I was hoping to just use cmake's CMAKE_USE_RELATIVE_PATHS
> since it is available.

I had the very same issue and decided to wrap with
basename function which is unfortunately evaluated at runtime.

with GCC you have gcc specific macro: __BASE_FILE__

another way to amortize the runtime cost is to initialize a static variable
for each file, something like:

static const char* static_filename = basename(__FILE__);

then you use "static_filename" in your source file.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to