[CMake] cross-compiling / host compiling
Alexander Neundorf
a.neundorf-work at gmx.net
Mon Jun 7 15:24:41 EDT 2010
On Monday 07 June 2010, Aeschbacher, Fabrice wrote:
> Thank you for responding
>
> Actually, I noticed that putting following line in the CMakeLists.txt of
> the tool that should not be cross-compiled also works:
>
> SET(CMAKE_C_COMPILER "gcc")
>
> The only drawback I found until now is that the native compiler (gcc) is
> not checked by cmake at startup (which is for us a minor issue)
Yes, you can set all the required variables manually, but this is not
recommended.
E.g. the results of try_compile() checks (like check_c_source_compiles(),
check_include_files() etc.) are cached globally, so they will have the value
for the compiler which was active in that directory, there will not be
separate results for the different compilers.
Also cmake will not know that e.g. it can't link the libraries from these
directories together etc.
If you are aware of these issue, it should work.
Alex
More information about the CMake
mailing list