Xcode 4 + llvm, How to ignore compiler warnings in specific directory? - xcode

I'm putting all my third party code in a /Vendor directory in my Xcode project. How can I suppress all compiler warnings in that directory?
I'm using Xcode 4 and LLVM 2.1.

You cannot set warning flags in Xcode by directory; directories have no meaning to Xcode, they don't form any form of "compile entity". You can set warning flags per Target, per Build Configuration, or on single files. This leaves you with two options:
Build all 3rd party code as an own target, e.g. make it a static library target, then build your code in another target and make it link against the static library of the first target. Each target can then have different warning flags.
Select all the 3rd party files in the list of files to build and override some of the warning flags (if a warning is turned on with -Wfoobar, then you can disable it with -Wno-foobar). Setting compile flags on single files is shown in the screenshot below; this can be done with multiple files at once.

Related

Where are Linker Flags in External C Library?

I have a C library which I need to use in my ongoing Xcode project. I used Cmake to build and install that Library. I gave the paths to Headers files and I can include the files into my Xcode project. However, when I run the project it says:
linker command failed with exit code 1 (use -v to see invocation)
I suspect that problem is with Linker Flags. I haven't included any Linker Flags and I don't know which flags do I need to add. Please tell me where in the library would I get all the required Linker Flags.
git hub link of the library which I want to add:
https://github.com/cbalint13/pba
From xcode left side window.
Under Project Navigator, click on your project, click on build settings.
Select "All" and "Combined" sections, then search for "Linker Flag"
Don't forget to switch to your target's build settings as well. As you might change just the "Project", not the "Target".

Add "-fobjc-arc" flag on specific files from command line

I'm working on a non-arc workspace,for specific files I added "-fobjc-arc" flag BuildPhases>CompileSources>. When I try to automate the build I'm unable to add the compiler flags. I have multiple targets, so i should pick the required target and add compiler flags for files in the target. Can it be handled while generating the project with CMAKE?
Any help here would be appreciated.

Adding an Objective-C++ file to a C++ Xcode 5 project

I am attempting to add an ObjC++ file to a large Xcode 5 C++ project.
For legacy reasons, the "Compile Sources As" setting must remain "C++". If I could change this setting to "According to File Type" the ObjC++ file would build properly, but it won't compile if Xcode thinks its a C++ file.
I have tried explicitly setting the Type of the .mm file under Identity and Type to "Objective-C++ Source" and the compiler still attempts to build it as a C++ file. I have tried adding the "-ObjC" and "-ObjC++" compiler flags to to the individual file under Build Phases > Compile Sources, and I get a warning that the argument is unused during compilation.
I have tried this process in reverse, adding an ObjC++ file to a different project that is compiling sources as "According to File Type," and setting the Type to C++. As expected, the file fails to build. This shows that specifying the type of an individual file takes precedence over the project setting.
Is there no way to force Xcode5.1.1/llvm5.1 to build a single ObjC++ or ObjC file as the correct type? The project setting is overridden by the individual file setting in every case I've tested, except trying to build an ObjC++ file. Is this a bug or missing feature?
You were close with the ObjC++ flag.
Set the file's Compiler Flags in the Compile Sources Build Phase to -x objective-c++ $(inherited).

CMake with Xcode 5 : how to add external libraries as 'Target Dependencies' instead of linker flags?

We are building our software under OS X (10.8 at the moment). The project build is managed by CMake (2.8.12).
External dependencies (i.e. not target added by project's CMakeLists) are handled using what we undestood as the canonical way :
Calling find_package(${external_lib}) from a root CMakeLists.
If a given target needs to link against the previously found package, the target's CMakeLists calls target_link_libraries(${TARGET_NAME} ${${external_lib}_LIBRARIES})
The procedure works nicely from a building perspective (the target is actually linked against the external library). Yet the external library is actually given as an additional flag to the compiler, in Build Settings::Other Linker Flags, when it seems that Xcode native way for doing this would be to add the dirname to Build Settings::Library Search Path, and the basename to Build phases::Target Dependencies.
Is there a way to achieve this behavior (without breaking the behavior for other platforms) ?
The behavior of CMake was changed years ago to use full paths.
http://www.cmake.org/cmake/help/v3.0/policy/CMP0003.html
Why do you want to split it?

Xcode Linker Issue - Other LD Flags won't clear

I am a noob and am having an issue with linker flags.
I tried building my own ssh2 libraries, and then afterwards I cloned a git repository with a project in the libraries already built.
Before I downloaded the compiled binaries, I was building with gcrypt and added the -lgrcrypt library to the other linker flags.
With this new library set that I am using, I no longer require gycrpt and so I removed the linker flags. However that did not clear the linker options. I am still getting all of the old linker flags in spite of clearing them in the project properties.
The error shows that the -lgrypt is still being processed as a linker flag:
-no_implicit_dylibs -mios-simulator-version-min=6.0 -lgcrypt
How can I reset the linker flags to what they were?
Thanks in advance
well i presume you have checked the flags and removed the path for that lib in your target level of the project, and also have clean the build and removed the previouse builds from organizer and inside xcode, and also have reset your simulator, and also have checked the project folder on your computer and removed that lib from the library folder of the project. these are the necessary steps and if you have done all of these then i cant think of anything else other than port your code to a new project and try to compile again. good luck my friend.

Resources