<div class="gmail_quote">On Mon, Sep 21, 2009 at 1:43 PM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Robert Dailey wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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:<br>
<br>
/Users/imac/work/redsword/CMakeLists.txt<br>
/Users/imac/work/redsword/projects/Newton/CMakeLists.txt<br>
<br>
The former script is the one that has the function:<br>
<br>
function( define_project )<br>
add_executable( .... )<br>
endfunction()<br>
<br>
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.<br>
</blockquote>
<br></div>
By the time the Xcode generator writes the path, there is no<br>
distinction between add_executable being called from the<br>
CMakeLists.txt directly or through the function. If you<br>
message() out the path inside your function just before<br>
or after add_executable, that is the path the generator will<br>
see. I expect it is correct, and the generator or Xcode<br>
does something funny....especially since it works in VS.</blockquote><div><br></div><div>I've attached a test project that reproduces this issue. At the root "test" directory, create a new directory called 'build'. So you will have "test/build".</div>
<div><br></div><div>cd into test/build and run:</div><div><br></div><div>cmake -G "Xcode" ..</div><div><br></div><div>This will generate an xcode project for you. Open that, and right click on main.cpp (which should be colored red because it is an invalid path) and click "Get Info". Look at the path. It's totally wrong. </div>
</div>