Re: [CMake] __FILE__ relative path

2011-12-28 Thread Michael Wild
set(SRCS a/a.cpp b/b.cpp c/c.cpp d/d.cpp) foreach(f IN LISTS SRCS) get_filename_component(b ${f} NAME) set_source_files_properties(${f} PROPERTIES COMPILE_DEFINITIONS MYSRCNAME=${b}) endforeach() add_executable(foo ${SRCS}) HTH Michael On 12/28/2011 08:17 AM, vivek goel wrote: Is

Re: [CMake] __FILE__ relative path

2011-12-28 Thread J Decker
ya - before using the file parameter, find the last / or '\' and print from there forward... you dono't need an absolute or relative path for that On Tue, Dec 27, 2011 at 11:17 PM, vivek goel goelvivek2...@gmail.com wrote: Is there any way to define custom macro as given in following answer

Re: [CMake] __FILE__ relative path

2011-12-28 Thread Michael Wild
If you don't want to have the full path embedded in the binary, you do. As an addendum to my previous answer, the string after the equal sign might need escaped quoting. Michael. On 28.12.2011, at 18:41, J Decker d3c...@gmail.com wrote: ya - before using the file parameter, find the last /

[CMake] __FILE__ relative path

2011-12-27 Thread vivek goel
How can I make cmake to compile source with relative path ? So that __FILE__ belongs to relative path of the file or there is another way I can replace __FILE__ with some other variable ? -- regards Vivek Goel -- Powered by www.kitware.com Visit other Kitware open-source projects at

Re: [CMake] __FILE__ relative path

2011-12-27 Thread J Decker
On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer e...@sf-mail.de wrote: Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: How can I make cmake to compile source with relative path ? So that __FILE__ belongs to relative path of the file or there is another way I can replace __FILE__

Re: [CMake] __FILE__ relative path

2011-12-27 Thread Rolf Eike Beer
Am Dienstag, 27. Dezember 2011, 09:18:15 schrieb J Decker: On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer e...@sf-mail.de wrote: Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: How can I make cmake to compile source with relative path ? So that __FILE__ belongs to relative

Re: [CMake] __FILE__ relative path

2011-12-27 Thread J Decker
On Tue, Dec 27, 2011 at 9:32 AM, Rolf Eike Beer e...@sf-mail.de wrote: Am Dienstag, 27. Dezember 2011, 09:18:15 schrieb J Decker: On Tue, Dec 27, 2011 at 1:42 AM, Rolf Eike Beer e...@sf-mail.de wrote: Am Dienstag, 27. Dezember 2011, 14:58:32 schrieb vivek goel: How can I make cmake to

Re: [CMake] __FILE__ relative path

2011-12-27 Thread vivek goel
Is there any way to define custom macro as given in following answer http://stackoverflow.com/questions/237542/learning-the-source-codes-filename-at-compile-time with cmake regards Vivek Goel On Tue, Dec 27, 2011 at 11:02 PM, Rolf Eike Beer e...@sf-mail.de wrote: Am Dienstag, 27. Dezember