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. --------- Robert Dailey On Mon, Sep 21, 2009 at 1:26 PM, Robert Dailey <rcdai...@gmail.com> wrote: > I don't have a sample project ready yet, but I will provide the generated > xcode project files in case you guys want to take a look at them. Open them > in a text editor and you'll see that the paths are weird. Relative files > appear as: > projects/Newton/source/SpawnShadowEntityAction.cpp > > This seems wrong. It should be: > > source/SpawnShadowEntityAction.cpp > > --------- > Robert Dailey > > > > On Fri, Sep 18, 2009 at 4:16 PM, Robert Dailey <rcdai...@gmail.com> wrote: > >> I'll see if I can get you guys a reproducible project. However, I hope you >> guys have access to the version of xcode I'm using. I'll also get you the >> version number next monday when I get back into work. >> >> On Fri, Sep 18, 2009 at 4:15 PM, Robert Dailey <rcdai...@gmail.com>wrote: >> >>> Yeah, that's what I'm doing... basically: >>> # Root CMakeLists.txt file: >>> function( func1 file ) >>> add_executable( foobar "${CMAKE_CURRENT_SOURCE_DIR}/${file}" ) >>> endfunction() >>> >>> function( define_project file ) >>> func1( ${file} ) >>> endfunction() >>> >>> # CMakeLists.txt in a lower subdirectory (Inside foobar project >>> directory): >>> define_project() >>> >>> The code above isn't exactly what I'm running, but more of a simplified >>> version. The goal here was to turn each source file into an absolute path by >>> prepending the CMAKE_CURRENT_SOURCE_DIR to it. When I print the path out >>> from the cmake script via message() it seems to be OK. >>> >>> >>> --------- >>> Robert Dailey >>> >>> >>> >>> On Fri, Sep 18, 2009 at 3:15 PM, David Cole <david.c...@kitware.com>wrote: >>> >>>> Sounds like maybe you are using "${CMAKE_CURRENT_SOURCE_DIR}" in a >>>> function or macro..... (defined at the top level, but called from a lower >>>> level)... >>>> >>>> >>>> On Fri, Sep 18, 2009 at 4:12 PM, Brad King <brad.k...@kitware.com>wrote: >>>> >>>>> Robert Dailey wrote: >>>>> >>>>>> Where is the CMakeLists.txt file containing this line? >>>>>> Perhaps "/Users/imac/work/redsword/CMakeLists.txt"? >>>>>> >>>>>> >>>>>> That's where the root one is, and this root script has all of the meat >>>>>> that the subdirectories call. This script is the one that has the >>>>>> functions >>>>>> that call add_executable() with the absolute paths. However, the script >>>>>> *calling* that function is in: >>>>>> >>>>>> /Users/imac/work/redsword/projects/foobar/CMakeLists.txt >>>>>> >>>>> >>>>> I'm having trouble reproducing this. I have >>>>> >>>>> # CMakeLists.txt >>>>> cmake_minimum_required(VERSION 2.6) # but I'm running 2.7.20090918 >>>>> project(FOO C) >>>>> function(my_add) >>>>> add_executable(${ARGN}) >>>>> endfunction() >>>>> add_subdirectory(A) >>>>> >>>>> # A/CMakeLists.txt >>>>> my_add(foo ${FOO_SOURCE_DIR}/A/foo.mm foo.c) >>>>> >>>>> In Xcode, the "Get Info" dialog for foo.mm says >>>>> >>>>> Name: A/foo.mm >>>>> Full path: /path/to/source/tree/A/foo.mm >>>>> >>>>> What is the symptom you're seeing? >>>>> Can you please send me a tarball with a minimal project? >>>>> >>>>> The version of xcode I'm using is the one that comes with the iPhone >>>>>> 3.1 SDK installer. I don't know how to find out the version number of >>>>>> xcode >>>>>> on the mac. I think it is xcode 3.1 though. >>>>>> >>>>> >>>>> Use the Xcode menu: >>>>> >>>>> Xcode -> About Xcode >>>>> >>>>> to see a version dialog. >>>>> >>>>> >>>>> -Brad >>>>> >>>>> _______________________________________________ >>>>> Powered by www.kitware.com >>>>> >>>>> Visit other Kitware open-source projects at >>>>> http://www.kitware.com/opensource/opensource.html >>>>> >>>>> Please keep messages on-topic and check the CMake FAQ at: >>>>> http://www.cmake.org/Wiki/CMake_FAQ >>>>> >>>>> Follow this link to subscribe/unsubscribe: >>>>> http://www.cmake.org/mailman/listinfo/cmake >>>>> >>>> >>>> >>> >> >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake