[CMake] Antwort: Antwort: Re:Antwort: Re: Toolchain with non-gcc argument format

Eric Noulard eric.noulard at gmail.com
Wed Nov 22 03:49:38 EST 2017


Hi Olivier,

Putting the list back.
You may try developer list as well.


2017-11-22 9:02 GMT+01:00 <oliver.zabel at egoproducts.com>:

> Hi,
>
> Is there really no way to override this var with a toolchain file? that
> seems somehow strange to me, since CMAKE is so configurable that i can't
> change "-I" to "-include=" .... what do i have to do?



I'm sorry I'm a little short in time to investigate that with you at the
moment and I hope some other people may step in.
The var "CMAKE_INCLUDE_FLAG_C" is NOT a toolchain file variable and it
won't end-up in the cache file.
AFAIK It is **only** used in compiler detection, e.g. at early stage of
project configuration when processing project(...)
or enable_language(..)

Adding new toolchain is not as flexible as adding a new **kind** of
compiler.
The knobs accessing for writing a toolchain are described here:
https://cmake.org/cmake/help/v3.10/manual/cmake-toolchains.7.html

There you can see that:
"Languages are enabled by the project() command. Language-specific built-in
variables, such as CMAKE_CXX_COMPILER, CMAKE_CXX_COMPILER_ID etc are set by
invoking the project() command."

Unless I'm wrong the toolchain mechanism does not include the capability to
change "-I" to "-include".

Now adding a new "kind" of compiler, a.k.a. compiler ID, enables you to
specify that include directive flag is " -include" (and many other things
as well)
Adding a new compiler ID requires to add files in
<CMakePrefix>/Modules/Compiler (see
https://github.com/Kitware/CMake/tree/master/Modules/Compiler)

as you can see it requires at least a couple of file to find a compiler and
one file per supported language (C, CXX, etc...)
in the C or CXX specific file you may use CMAKE_INCLUDE_FLAG_C and other
variables:

see e.g.:
https://github.com/Kitware/CMake/blob/master/Modules/Compiler/TI-C.cmake

I did never add a new kind of compiler so I hope people with more knowlegde
than me in this area will explain that part better than me.

Eric



>
>
>
> 2017-11-16 9:44 GMT+01:00 <*oliver.zabel at egoproducts.com*
> <oliver.zabel at egoproducts.com>>:
> I did not find the CMAKE_INCLUDE_FLAG_C in the CMake cache - is it
> possible that this is somehow ignored?
>
> This variable is used by CMake **builtin compiler** discovery and
> configuration.
> The file are are put in "Modules/Compiler" there is one per-langage and
> per-compiler ID:
> *https://cmake.org/cmake/help/v3.7/variable/CMAKE_LANG_COMPILER_ID.html*
> <https://cmake.org/cmake/help/v3.7/variable/CMAKE_LANG_COMPILER_ID.html>
>
> I don't know the exact processing order of this set of files.
>
> Toolchain files:
> *https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html*
> <https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html>
> does not use or contain such variables.
>
> --
> Eric
>
>


-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171122/67603c12/attachment-0001.html>


More information about the CMake mailing list