[CMake] [Dev] CMake 2.5-20070519 and tool chain support

kitts kitts.mailinglists at gmail.com
Wed May 23 12:38:59 EDT 2007


On Wednesday 23 May 2007 9:36:56 pm Alexander Neundorf wrote:
> > OK. I recently added support for the IAR toolchain in my project. IAR is
> > quite different when compared to GCC variants that I had used until now.
> > IAR itself is available for multiple architectures and the difference is
> > only in the name of the executable (An assumption there... I have only
> > used it for two architectures).
> >
> > One problem I faced is that IAR's executables are not found in the PATH
> > variables and they do not include standard libraries (and headers) when
> > executed from the command line. So when I offer my project tree to
>
> Do you mean compiling a "hello world"-style program will not work because
> it can't find the C library and because it won't find standard system
> include files without explicitely specifying the system include directories
> on the command line ?

Yes! This is still hard for me to believe and wonder if i am missing some 
option that does the opposite of GCC's -nostdlib but i can't find it!

> > another I would need to provide additional modules that would search for
> > the installation path of IAR in their system, set the compiler options
> > and flags accordingly or complain if not found.
> >
> > So I need two modules here that would be present in the project tree.
> > FindIAR.cmake and windows-IAR.cmake. The later could also take care of
> > the specific architecture requirements. I am not very sure about how it
> > works currently but I would like that cmake looks into my project tree
> > for those modules before (or maybe after?) it searches ${CMAKE_ROOT}.
>
> You will need:
> -a IAR.cmake which sets up the compile rules etc. for the iar compiler
> -a Toolchain-Windows-IAR.cmake file to be used with -DCMAKE_TOOLCHAIN_FILE

And i just place them in the project folder? And pass the following arguments 
to the cmake 
command?"-DMCU=AT91RM9200 -DCMAKE_TOOLCHAIN_FILE=./Toolchain-Windows-IAR.cmake"

AT91RM9200 because there are variants within the ARM architecture and each 
requires its own specific flags.

> > In such cases I also wonder on a few other things. Is it really
> > necessary that the compiler setting is set in stone? It would be
> > convenient if the user could start up the GUI and make a selection
> > there. Can there be enumerated lists that the user can choose from? And
> > if there can be dynamic changes in lists depending on other variables
> > (Like toolchain options based on architecture choice). But these are
> > another topic.
>
> This is currently not possible. You can force cmake to use a special
> compiler either by setting the CC/CXX env. variables or (with cmake cvs) by
> using CMAKE_TOOLCHAIN_FILE.

Yes. But damn those windows users... they only want to point and click!! ;-)

> Is there a definition which can be used to detect this compiler, like
>
> #ifdef _IARCC_
>
> or something like this ?

Yes. Its __ICCARM__ for ARM and __ICCAVR__ for AVR.

-- 
Regards,
Kishore


More information about the CMake mailing list