[CMake] CMAKE_CURRENT_LIST_FILE in CMake 2.6.3
KSpam
keesling_spam at cox.net
Tue Mar 24 17:43:43 EDT 2009
Bill,
On Tuesday 24 March 2009 13:40:29 Bill Hoffman wrote:
> KSpam wrote:
> > My build system relies heavily on CMAKE_CURRENT_LIST_FILE. For instance,
> > I typically get a variable for the directory containing the current list
> > file as follows:
> >
> > get_filename_component(scriptDir ${CMAKE_CURRENT_LIST_FILE} PATH)
> >
> > This has worked in prior versions of CMake; however, it does not work in
> > CMake 2.6.3 (apparently, CMAKE_CURRENT_LIST_FILE is empty). Is this a
> > bug, or is it by design?
>
> Should work. Do you have a small example that shows this issue?
I attached a small example with the problem. The problem is actually a bit
more complicated than my original explanation. I have a macro in my
top-level CMakeLists.txt file:
macro (getScriptDir _scriptDir)
get_filename_component(${_scriptDir} ${CMAKE_CURRENT_LIST_FILE} PATH)
endmacro (getScriptDir)
When I simply call get_filename_component from my included script, I get the
right value, but when I call the macro I do not get the right value.
I tested this on Linux with 2.6.1 and 2.6.3, and I tested this on Windows with
2.6.2 and 2.6.3. On both platforms the 2.6.3 fails and the earlier version
works.
Thanks,
Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_test.zip
Type: application/x-zip
Size: 1305 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090324/6e102923/attachment.bin>
More information about the CMake
mailing list