[CMake] Cross compile to platform with two stage compiler.

Nils Gladitz nilsgladitz at gmail.com
Thu Jul 3 08:18:12 EDT 2014


On 07/02/2014 10:04 PM, Eric LaFranchi wrote:
> Yes. The cross compiler is run on Windows and we are setup to use either
> Windows Command Prompt or Cygwin shell.
>
> What arguments will be passed into the script that is set using the
> CMAKE_FORCE_C_COMPIELR macro? I assume this is going to be “compiler
> flags”, “source file”, and “target file”?
>
> The compiler is not known to CMake and I assume that I will need to
> create a “Compiler”-C.cmake and put it in my local cmake modules path?

I haven't tried setting up a custom compiler myself so I am not sure if 
I might be missing something vital but ...

if you do set up a custom <Compiler>-C.cmake you will have control over 
how parameters will get passed to the script.

The most relevant variable to set up for this might be:
http://cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_COMPILE_OBJECT.html

The script itself could be made part of this rule variable and the 
actual compiler could be passed in as a parameter.

That way use of the script may be more transparent since you'd still 
refer to the actual compiler when setting it up with CMAKE_FORCE_C_COMPILER.

Nils


More information about the CMake mailing list