conan icon indicating copy to clipboard operation
conan copied to clipboard

[feature] Add IAR Compiler to settings

Open JulianH1989 opened this issue 3 months ago • 4 comments

ADD IAR Compiler to settings.yml

Hey, we are building some targets using IAR compiler. Unfotunately IAR seams to be missing in the settings.yml.

I did add this to my settings_user.yml wich makes my project work.

compiler:
   IAR:
        version: ["9.50.2"]

But it would be nice if we could add IAR to the default settings.yml

Have you read the CONTRIBUTING guide?

  • [ ] I've read the CONTRIBUTING guide

JulianH1989 avatar Nov 17 '25 15:11 JulianH1989

Hi @JulianH1989

Thanks for your suggestion.

Adding a new compiler to the default settings typically doesn't make any sense, unless it is fully integrated in the different build-system integrations such as CMakeToolchain, AutotoolsToolchain, etc. Furthermore, defining the compiler.version doesn't seem enough, there are many other variables to compilers that affect the final binary, like the libcxx, the runtime, etc.

So the recommendation for these custom compilers is to add the to your settings_user.yml, and then manage it with conan config install/install-pkg with the custom profiles you would define for such a compiler, that will also be distributed with conan config install/install-pkg anyway, so the settings_user.yml doesn't really add any new steps.

memsharded avatar Nov 17 '25 16:11 memsharded

Hi @JulianH1989

Any feedback about this? I am curious how you are managing the build-system integration, as many tools like build systems and Conan integrations such as the CMakeToolchain and others will not recognize that compiler and probably not set automatically some things that are done for other known mainstream compilers.

memsharded avatar Nov 25 '25 18:11 memsharded

Hey @memsharded we have only done a POC so far. The chanellenge using IAR is that you can't really specify many flags which would make different binaries incompatible. So far we are only using

  • IAR Version
  • Arch (--cpu=cortex-m4 in our case)
  • Lib C++ (--libc++) true/false

IAR does not seam to allow to specifiy the C++ standard. Depending on the IAR version you will get a predefined cxx standard.

We are installing this as a user settings before the first call of find_package() (which invokes the conan cmake provider). This works for our POC at the moment :)

JulianH1989 avatar Nov 27 '25 08:11 JulianH1989

Thanks for the feedback!

One of my concerns with it is that many third party open source packages from ConanCenter, that use different build systems like autotools, meson, etc, might not be able to work with such a custom compiler=iar, because often they have logic such as if self.settings.compiler == "gcc": # do something, and also might rely on the logic of the AutotoolsToolchain and others to inject flags, etc. So maybe if you try to build different third party from ConanCenter with that compiler, you might get compilation errors.

This is why it cannot be added that way to the default settings.yml, because it would create an unrealistic expectation that it will work.

But otherwise, if it is working for you so far, that is great to hear! Then I still think that the best way at this moment is to add the definition to your settings_user.yml. This ticket will be closed soon as unplanned, but don't hesitate to open new tickets for any further question or issue related to using this compiler. Thanks again for the feedback!

memsharded avatar Nov 28 '25 08:11 memsharded