[CMake] CMAKE_C_COMPILER ignored
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Jan 2 09:25:00 EST 2008
On Tuesday 01 January 2008, Volker wrote:
> Hi and a happy new year to everyone.
>
> I'm new to cmake and using it on a cross compile project (i386 linux -> arm
> linux)
>
> Somehow CMAKE_C_COMPILER in my CMakeList.txt is ignored.
> This is my CMakeList.txt file:
>
> PROJECT(myproject)
> ADD_EXECUTABLE(myproject some files ...)
> SET( CMAKE_C_COMPILER arm-linux-gcc )
> SET( CMAKE_CXX_COMPILER arm-linux-g++ )
>
> cmake always detects the host compiler instead of the specified one:
> -- Check for working C compiler: /usr/bin/gcc
> -- Check for working C compiler: /usr/bin/gcc -- works
> [...]
>
> The specified compilers are in my PATH and executable.
>
> What i'm doing wrong?
Two things:
1) if you set CMAKE_C_COMPILER to arm-linux-gcc, this compiler will be used in
this and in all subdirectories. The set happens after the "Check for working
C compiler", so the automatically detected one will be ignored.
2) even although it will work somewhat, you shouldn't do it that way (problems
with the cache, configure checks etc.). Instead use cmake cvs (2.6.0 is not
far away) and use it for cross compiling as described here:
http://www.cmake.org/Wiki/CMake_Cross_Compiling
If you have questions/problems/suggestions, please post it here.
Alex
More information about the CMake
mailing list