Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake: how to properly setup new toolchain to avoid "System is unknown to CMake" message?

I have setup a new CMake toolchain file to cross-compile for the STxP70 processor. I placed the file in my working directory and simply call cmake using:

$ cmake -DCMAKE_TOOLCHAIN_FILE=STxP70_toolchain.cmake ...

It works properly, but I always get a message that says:

System is unknown to cmake, create:
Platform/STxP70 to use this system, please send your config file to [email protected] so it can be added to cmake

Is there a way to place the toolchain file somewhere locally so that CMake will recognize it and not complain that the system is unknown? I can't seem to find it anywhere.

Thanks in advance.

like image 514
vschwambach Avatar asked Jul 23 '14 10:07

vschwambach


1 Answers

Your toolchain file STxP70_toolchain.cmake is found correctly by CMake, because otherwise you would see message like:

Could not find toolchain file: STxP70_toolchain.cmake

The message you see comes from setting variable CMAKE_SYSTEM_NAME, e.g. command

cmake .. -DCMAKE_SYSTEM_NAME="BLAH"

produces message:

System is unknown to cmake, create:
Platform/BLAH to use this system, please send your config file to [email protected] so it can be added to cmake

Documentation states:

CMAKE_SYSTEM_NAME:

this one is mandatory, it is the name of the target system, i.e. the same as CMAKE_SYSTEM_NAME would have if CMake would run on the target system. Typical examples are "Linux" and "Windows". This variable is used for constructing the file names of the platform files like Linux.cmake or Windows-gcc.cmake. If your target is an embedded system without OS set CMAKE_SYSTEM_NAME to "Generic". If CMAKE_SYSTEM_NAME is preset, the CMake variable CMAKE_CROSSCOMPILING is automatically set to TRUE, so this can be used for testing in the CMake files.

You can set CMAKE_SYSTEM_NAME to Generic to disable warning saying that STxP70.cmake is not present in the CMake distibution directory install\path\to\CMake\share\cmake-2.8\Modules\Platform\

like image 142
Peter Avatar answered Oct 24 '22 05:10

Peter