View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002582CMakeCMakepublic2005-12-09 15:422016-06-10 14:30
Reporterkarl 
Assigned ToKitware Robot 
PrioritylowSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0002582: Set XCode arguments from CMakeLists.txt
DescriptionIs there a way to set the XCode internal variables from CMake? As a specific example, I have an application that uses the DYLD_LIBRARY_PATH to find shared libraries during development. XCode requires that the environment variable be set internally on the executable so that the executable can be run/debugged. I can set it within XCode but it gets lost everytime I rebuild the project with CMake. Is there anyway to set the DYLD_LIBRARY_PATH from my CMakeLists.txt?
TagsNo tags attached.
Attached Files

 Relationships
related to 0009125closedDavid Cole Add support to set GCC Version and Deployment Target for XCode projects 

  Notes
(0003396)
Bill Hoffman (manager)
2005-12-12 11:31

How do you set variables like that from the Xcode GUI?
What menu item do you use?
(0003398)
karl (reporter)
2005-12-12 11:48

It took me a while to find out how to do this and my frustration level with XCode is fairly high right now (and it has _nothing_ to do with CMake!)

Expand the executable item in the Groups and Files window. Double click on the executable that is listed there. This will bring up a dialog box entitled "executable_name" info. Select the Arguments option from the top of the dialog. At the bottom of that pane you will see plus and minus symbols. Select plus to add a new environmental variable. Give the environment variable name and then click on the left hand side to set the variable.

The results of this action are saved in the .pbxuser file

               debuggerPlugin = GDBDebugging;
               disassemblyDisplayState = 0;
               dylibVariantSuffix = "";
               enableDebugStr = 1;
               environmentEntries = (
                        {
                                active = YES;
                                name = DYLD_LIBRARY_PATH;
                                value = "/Developer/qt-3.3.4/lib:/usr/local/eng_sci/cubit/verdict/verdict1.1.2/lib:/usr/local/eng_sci/cubit/VTK/VTK-4.2.2/bin
                        },
                );
                isa = PBXExecutable;
(0004594)
karl (reporter)
2006-08-01 16:48

It looks like the location of the option has changed in XCode 2.2. I now find the arguments by selecting the menu option Project/Edit Active Executable and Selecting Arguments from the top of the resulting dialog.
(0008503)
Gabriel Beauchemin (reporter)
2007-08-17 13:33

See 0001260' attachments for a possible solution. I added support for GCC_xxx to be passed as attributes. The same could be done for others

Gabriel
(0008582)
Brad King (manager)
2007-08-22 13:32

Gabriel's approach is to put the xcode "GCC_*" properties into the COMPILE_FLAGS target property and then parse them out in cmGlobalXCodeGenerator. We're trying to move away from putting everything in COMPILE_FLAGS in favor of other more specific target properties.

Perhaps we can come up with some form of target properties that get transformed into Xcode attributes.
(0008583)
Brad King (manager)
2007-08-22 13:45

Upon closer inspection I see that Gabriel's proposal does not solve the problem originally reported. The request in this issue is to set the environment variables under which programs are run through the IDE, not to set Xcode attributes.
(0009451)
Sean McBride (reporter)
2007-10-12 13:45

FYI, relying on DYLD_LIBRARY_PATH is probably a bad idea, see:

http://docs.info.apple.com/article.html?artnum=305509 [^]
(0014917)
karl (reporter)
2009-02-12 16:08

I realize that DYLD_LIBRARY_PATH is a nasty thing to do to a user . . . but I'm typically using this in a development environment while testing with a specific library version. This problem is still a pain.
(0014918)
Brad King (manager)
2009-02-12 16:30

Currently CMake only generates the "project.pbxproj" file and does not touch the .pbxuser file. If a user has loaded the project and adjusted preferences, we do not want to erase those changes by regenerating the pbxuser file. I don't think we should create a first-class CMake feature for this.

I suggest putting code in your CMakeLists.txt file to create the .pbxuser file yourself (perhaps only if it doesn't exist). Untested code:

set(pbxfile "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.xcodeproj/project.pbxuser")
if(NOT EXISTS "${pbxfile}")
  file(WRITE "${pbxfile}" "
...
")
endif()
(0041303)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2007-08-17 13:33 Gabriel Beauchemin Note Added: 0008503
2007-08-22 13:32 Brad King Note Added: 0008582
2007-08-22 13:45 Brad King Note Added: 0008583
2007-10-12 11:39 Bill Hoffman Assigned To Bill Hoffman => Brad King
2007-10-12 13:45 Sean McBride Note Added: 0009451
2009-02-12 16:08 karl Note Added: 0014917
2009-02-12 16:30 Brad King Note Added: 0014918
2011-02-08 14:34 David Cole Relationship added related to 0009125
2012-02-02 08:03 Brad King Assigned To Brad King =>
2012-02-02 08:03 Brad King Status assigned => backlog
2016-06-10 14:27 Kitware Robot Note Added: 0041303
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:27 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team