Making CMake *not* use -isystem at all

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Making CMake *not* use -isystem at all

Attila Krasznahorkay
Dear All,

I'm still debugging the performance problems of our build. But now I bumped into another surprising thing.

Our "highest level" packages can depend on a *lot* of low level packages. The one I'm testing now depends on more than 180 of them.

This generates >180 -isystem flags for the compilation lines. But I found a very surprising thing. If I replace all of these -isystem flags with -I ones by simply modifying the flags.cmake files that CMake generated for me, the build time of my code is cut to less than half of what it is when using -isystem.

So... How do I tell CMake to forget about using -isystem all together, and take all my include directories with -I?

Not using SYSTEM in target_include_directories and include_directories doesn't seem to make a difference. I still get all my out-of-source directories with -isystem. I even tried setting CMAKE_INCLUDE_SYSTEM_FLAG_CXX and CMAKE_INCLUDE_SYSTEM_FLAG_C to "-I " forcefully. But this didn't help either. Neither did explicitly unsetting these variables.

How could it be done then? How could I force CMake to always use -I for the directories that I give to either include_directories or target_include_directories?

Cheers,
              Attila
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Making CMake *not* use -isystem at all

Alexander Neundorf-3

On Monday, December 07, 2015 15:39:40 Attila Krasznahorkay wrote:

> Dear All,

>

> I'm still debugging the performance problems of our build. But now I bumped

> into another surprising thing.

>

> Our "highest level" packages can depend on a *lot* of low level packages.

> The one I'm testing now depends on more than 180 of them.

>

> This generates >180 -isystem flags for the compilation lines. But I found a

> very surprising thing. If I replace all of these -isystem flags with -I

> ones by simply modifying the flags.cmake files that CMake generated for me,

> the build time of my code is cut to less than half of what it is when using

> -isystem.

>

> So... How do I tell CMake to forget about using -isystem all together, and

> take all my include directories with -I?

>

> Not using SYSTEM in target_include_directories and include_directories

> doesn't seem to make a difference. I still get all my out-of-source

> directories with -isystem. I even tried setting

> CMAKE_INCLUDE_SYSTEM_FLAG_CXX and CMAKE_INCLUDE_SYSTEM_FLAG_C to "-I "

> forcefully. But this didn't help either. Neither did explicitly unsetting

> these variables.

 

I would have expected this to work.

Maybe set them to -I on the initial cmake run ?

 

Alex

 


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Making CMake *not* use -isystem at all

Attila Krasznahorkay
Hi Alex,

From what I could see, if the base CMake code decides that internally CMAKE_INCLUDE_SYSTEM_FLAG_CXX needs to be set to “-isystem “, then I can’t influence this decision from the outside.

But the reason that the decision between using -I and -isystem seemed so inexplainable to me was that my project uses imported targets quite heavily. And as I had to learn, CMake treats the include directories set on imported libraries as system includes by default. Regardless whether those were set as system includes originally or not. After some google-ing I found out about it here:

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

After setting CMAKE_NO_SYSTEM_FROM_IMPORTED to TRUE, my project now uses -I and -isystem includes as I originally expected it to.

And it could still be interesting to people that apparently using -isystem for directories on network disks is not a good idea. I’m really not sure what GCC does in the background exactly, but it clearly has some noticeable overhead over using -I for the same directories. So for now I just stopped using system include directories myself completely.

Cheers,
        Attila

> On Dec 7, 2015, at 10:05 PM, Alexander Neundorf <[hidden email]> wrote:
>
> On Monday, December 07, 2015 15:39:40 Attila Krasznahorkay wrote:
> > Dear All,
> >
> > I'm still debugging the performance problems of our build. But now I bumped
> > into another surprising thing.
> >
> > Our "highest level" packages can depend on a *lot* of low level packages.
> > The one I'm testing now depends on more than 180 of them.
> >
> > This generates >180 -isystem flags for the compilation lines. But I found a
> > very surprising thing. If I replace all of these -isystem flags with -I
> > ones by simply modifying the flags.cmake files that CMake generated for me,
> > the build time of my code is cut to less than half of what it is when using
> > -isystem.
> >
> > So... How do I tell CMake to forget about using -isystem all together, and
> > take all my include directories with -I?
> >
> > Not using SYSTEM in target_include_directories and include_directories
> > doesn't seem to make a difference. I still get all my out-of-source
> > directories with -isystem. I even tried setting
> > CMAKE_INCLUDE_SYSTEM_FLAG_CXX and CMAKE_INCLUDE_SYSTEM_FLAG_C to "-I "
> > forcefully. But this didn't help either. Neither did explicitly unsetting
> > these variables.
>  
> I would have expected this to work.
> Maybe set them to -I on the initial cmake run ?
>  
> Alex
>  

--

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