[CMake] behaviour change with SET SOURCE FILES PROPERTIES( OBJECT DEPENDS)

Brad King brad.king at kitware.com
Mon Jul 11 09:36:40 EDT 2005


Alexander Neundorf wrote:
> Hi,
> 
> please try the attached test case.
> The problem here is (actually the same as the previous problems with
> CONFIGURE_FILE and ADD_CUSTOM_COMMAND) that the working directory of make
> with the new makefile generator has changed and so all relative paths work
> differently.
> This is also the case for
> in src/foo/:
> 
> SET_SOURCE_FILES_PROPERTIES(main.c PROPERTIES OBJECT_DEPENDS foo.h)
> 
> This generates the rule
> 
> foo/main.c : foo.h
> 
> which should better be:
> 
> foo/main.c: foo/foo.h
> 
> I can work around it by prepending ${CMAKE_CURRENT_SOURCE_DIR}, but it
> worked with previous versions of the makefile generator.

I need to point out here that even with CMake 2.0 none of the old 
relative path behavior would work with an out-of-source build.  That has 
always required full paths for these commands to work properly.  I don't 
think very many commands were ever meant to deal with relative paths, 
though the documentation was not very clear about this.

If we want to support relative paths like this for all commands someone 
will have to make a sweep through the code to change the way commands 
interpret their arguments.  I don't think this will get done for 2.2 so 
I suggest you use full paths (which is easy thanks to 
CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR) for now.

Meanwhile I've created this feature request for the issue:

http://www.cmake.org/Bug/bug.php?op=show&bugid=2036&pos=0

-Brad


More information about the CMake mailing list