I managed to get my C++ project running in Xcode using cmake -G Xcode. Now I would like to debug it, because of the nice gdb fronted it provides.
However I need to change the working directory where gdb is executed otherwise it wont work. (It needs to read some data from files relative to the path of the working directory) What I can do is after gdb has stopped typing cd working_dir and then run it manually typing r. This works, but Xcode will complain constantly and is also not an elegant solution.
So somewhere in the build settings I should be able to set the working directory..but where?!
Answer: Use the cd Command The current working directory is the directory or folder where you are currently working. You can use the cd (change directory) command to change the current working directory or move around the file system. This command will work in all Linux distribution.
It should by located in: ~/Library/Developer/Xcode/DerivedData . Show activity on this post. You can configure the output directory using the CONFIGURATION_BUILD_DIR environment variable.
Xcode offers several ways to add existing files and folders to your project: Drag the files from the Finder into the Project navigator. Click the Add button (+) in the Project navigator's filter bar, and choose Add Files to “projectName”. Choose File > Add Files to “projectName”.
$(SRCROOT) (aka $(SOURCE_ROOT) ) is a path to your location where a . xcodeproj is. It is simple to check, just put it in a field and Xcode gives you a tip.
Just updating this solution to XCode 4.x
You go on Product -> Scheme -> Edit Scheme
On the tab Options you choose your working directory.
In Xcode 4 the working directory settings is under Scheme Settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With