[CMake] Xcode paths not turning out right

Brad King brad.king at kitware.com
Mon Sep 21 14:43:24 EDT 2009


Robert Dailey wrote:
> My paths are correct. I'm passing in the correct absolute paths into 
> add_executable. I think that cmake is using the current cmake file 
> instead of using the one that the function call originated from. For 
> example, I have two CMake scripts:
> 
> /Users/imac/work/redsword/CMakeLists.txt
> /Users/imac/work/redsword/projects/Newton/CMakeLists.txt
> 
> The former script is the one that has the function:
> 
> function( define_project )
>   add_executable( .... )
> endfunction()
> 
> And the latter script calls the define_project() function. Can anyone 
> peek at the CMake source to see if this is indeed the case? Again, I'll 
> try to find time to provide a reproducible test project.

By the time the Xcode generator writes the path, there is no
distinction between add_executable being called from the
CMakeLists.txt directly or through the function.  If you
message() out the path inside your function just before
or after add_executable, that is the path the generator will
see.  I expect it is correct, and the generator or Xcode
does something funny....especially since it works in VS.

-Brad


More information about the CMake mailing list