[CMake] Xcode paths not turning out right

Robert Dailey rcdailey at gmail.com
Fri Sep 18 17:15:33 EDT 2009


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.cole at 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.king at 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090918/61aa1a92/attachment-0001.htm>


More information about the CMake mailing list