[CMake] cmake // how to get compiler default include search path

Alexander Neundorf a.neundorf-work at gmx.net
Wed Apr 22 16:29:21 EDT 2009


On Wednesday 22 April 2009, Sergey Nikulov wrote:
> Hi All,
>
> Could you please suggest me how to get default compiler include search
> path with cmake?
>
> For example gcc -c -v empty.c gives
>
> <... skip ...>
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/local/include
>  /usr/lib/gcc/i386-redhat-linux/4.1.1/include
>  /usr/include
> End of search list.
> <... skip ...>
>
> Is that information available within Cmake in cross platform way?
> Something like CMAKE_<LANG>_DEFAULT_INCLUDE_PATH?

You can have a look at Modules/CMakeEclipseCDT4Generator.cmake, it does just 
that. 
But this is new and internal-only, so don't rely on the code staying there 
unchanged (but you can use it as inspiration).

Alex


More information about the CMake mailing list