CMake Toolchain File for GHS

2.2k Views Asked by At

I am trying to create a cmake toolchain file for the GreenHills compiler. When I am using cmake -T C:\ghs\multi506 everything works fine. But after creating a toolchain file with the line set(GHS_TOOLSET_ROOT C:/ghs/multi506) I get the error message:

CMake Error: No GHS toolsets found in GHS_TOOLSET_ROOT "C:/ghs/multi506/"

What is the problem?

1

There are 1 best solutions below

0
On

The use of -T and GHS_TOOLSET_ROOT is finicky. This is because of trying to maintain backward compatibility with the original generator implementation of trying to find the "latest" compiler.

'-T' takes either a absolute path or a relative path.

-T C:\ghs\multi506 means that the compilers are in this directory. It will contain gbuild.exe, etcetera.

-T multi506 will append multi506 to GHS_TOOLSET_ROOT. Therefore CMake will look for gbuild.exe in C:\ghs\multi506.

If you don't use -T then auto search mode is enabled. CMake will search for directories named comp_[^;]+, which is the naming scheme Green Hills uses for its compilers, in GHS_TOOLSET_ROOT. So in this case it will be looking for something like C:\ghs\multi506\comp_20210504.

I prefer using -T with an absolute path to the compiler directory.