[CMake] Cannot include third-party Framework headers directories as system directories in XCode for avoiding their warning

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Wed May 11 03:25:24 EDT 2016


Hi,

I'm a bit surprised by this. I had to explicitly tell CMake not to treat includes coming from imported targets as system includes. Using this variable:

https://cmake.org/cmake/help/v3.0/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.html
https://cmake.org/cmake/help/v3.0/prop_tgt/NO_SYSTEM_FROM_IMPORTED.html

So I think this is in general a MacOS specific issue. I remember reading about such issues a while ago. That CMake would not recognise that MacOS X's clang would accept the -isystem argument out of the box.

Cheers,
              Attila

> On 10 May 2016, at 18:16, tetractius <tetractius at gmail.com> wrote:
> 
> Hi list,
> 
> I have an issue caused by a warning in the qt5 brew version in osx when using Xcode generator
> 
> I can safely find the qt framework in the brew cellar:
> 
> set(CMAKE_PREFIX_PATH /usr/local/opt/qt5)
> find_package(Qt5Widgets REQUIRED)
> 
> and with this I can easily add this framework to my project by using
> 
> target_link_libraries(myApp Qt5::Widgets)
> 
> and this, as per documentation will cause to add all the -I<headers framework directories> when compiling the .o files for this target.
> 
> The problem is that QT has some warning in their headers at the version 5.6 and 5.5.2_1 (that is all the qt5 the versions available in brew)
> and the -I<headers framework directory> it is not a system include parameter.
> 
> 
> So assuming that I cannot avoid to use the brew version and I cannot fix the problems in the qt5 headers,
> 
> How can I tell to cmake that these framework include directories are system include directories and thus they need to be included with -isystem in the xcode project?
> 
> I tryed to manually pass the flag to the compiler but the target_link_libraries function, when used with the framework, it will always put their include directories in front of mine without the isystem flag.
> 
> 
> 
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list