First of all, I've never developed with Xcode. I have a project that has been developed by me under a certain environment (Linux and emacs) and now some colleagues that use a different environment will work with me. This is a C++ project that uses CMake.
Long story short:
The problem
Xcode developers will use the executable that appears under the Executables list of the Group & Files window of Xcode. They will configure it by double-clicking and add their tweaks (configuring debugging directories, setting environment variables, but more importantly, setting the arguments of the executable).
When a developer (me) changes the CMakeLists.txt
(namely to add a new source file), the XCode developers are forced to re-generate their project and they lose all the configuration mentioned above.
Question: Is there a way to avoid this?
If each Xcode developer constantly loses that configuration I would certainly be the only one using CMake. :(
Thanks for your help!
You can edit CMakeLists. txt files right in the Editor. Make sure to reload the project after editing. Automatic reload feature is disabled by default, you can turn it on by selecting the Automatically reload CMake project on editing checkbox in Settings / Preferences | Build, Execution, Deployment | CMake.
CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists. txt file is automatically generated under the project root.
It is just a console app written in C++ and cmake project. It is also on git repo. Xcode Version 8.0 (8A218a) OS El Capitan 10.11.
CMake can generate a native build environment that will compile source code, create libraries, generate wrappers and build executables in arbitrary combinations. CMake supports in-place and out-of-place builds, and can therefore support multiple builds from a single source tree.
I think you are going to lose this one. Xcode stores all the project definitions in a file called Foo.xcodeproj/project.pbxproj. When one of your Mac developers changes a flag or setting, it's recorded in the project.pbxproj file. When you change your CMakeLists.txt file, CMake triggers a rebuild of project.pbxproj, wiping out all the Mac developer's changes. Xcode was not designed with CMake in mind, and they two work only so well together.
One possible solution (which isn't the greatest for the Mac developers) is to use CMake to generate makefiles. They would need to write a few custom commands in Xcode which invoke CMake/Make to build the executables, but they would be able to pass arguments into CMake to control the build process. The executables would be defined separately to Xcode, and CMake would only wipe out the Makefiles. This might be a way to keep everyone happy.
The CMake folks have not given Xcode the attention it deserves, IMHO. But this limitation is inherent in Xcode's architecture, and will be a tough nut.
Hope this helps,
-dan
Edit:
Your Xcode developers have some limited ability to use "User-Defined Settings". I don't know to how to use these (I'm an emacs/make-sort of guy), but perhaps they could use these to override CMake's 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