[CMake] CMAKE_USE_RELATIVE_PATHS
Eric Noulard
eric.noulard at gmail.com
Sat Nov 21 18:26:00 EST 2009
2009/11/21 barcaroller <barcaroller at 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
More information about the CMake
mailing list