[CMake] Cross-compiling: Cmake compiler and ABI check don´t work / TRY_COMPILE and EXECUTABLE_SUFFIX problem

Schmid Alexander A.Schmid at de.ccv.eu
Mon Feb 21 02:14:14 EST 2011


On Friday 18 February 2011, Schmid Alexander wrote:
> Hi,
>
> of course, I´d like to have you think further about it, so here you go...

;-)

> This is the toolchain file I use.
> The specialty about is that I want to use the ARMCC as compiler and an
> SDK-provided linker tool for linking.
>
> # this one is important
> SET( CMAKE_SYSTEM_NAME Generic )
> # this one not so much
> SET( CMAKE_SYSTEM_VERSION 1 )
>
> #
> ---------------------------------------------------------------------------
>------ # setup local variables used
> #
> ---------------------------------------------------------------------------
>------
>
> SET( SDK1_ROOT "$ENV{PROJ_ROOT}\\tools\\Sdk1" )
> message( STATUS "The SDK1 can be found at ${SDK1_ROOT}" )
> SET( SDK1_INCLUDE "${SDK1_ROOT}/include" )
> STRING( REPLACE "\\" "/" SDK1_INCLUDE ${SDK1_INCLUDE} )
> SET( SDK1_LIB "${SDK1_ROOT}/lib" )
> STRING( REPLACE "\\" "/" SDK1_LIB ${SDK1_LIB} )
>
> SET( SDK2_ROOT "$ENV{PROJ_ROOT}\\tools\\Sdk2" )
> message( STATUS "The SDK2 can be found at ${SDK2_ROOT}" )
> SET( SDK2_INCLUDE "${SDK2_ROOT}/include" )
> STRING( REPLACE "\\" "/" SDK2_INCLUDE ${SDK2_INCLUDE} )
> SET( SDK2_LIB "${SDK2_ROOT}/lib" )
> STRING( REPLACE "\\" "/" SDK2_LIB ${SDK2_LIB} )
>
> SET( RVCT40_BIN "$ENV{RVCT40BIN}" )
> message( STATUS "The ARM Tools can be found at ${RVCT40_BIN}" )


Does it work if you replace the all the $ENV{}s with hardcoded paths ?
Please try that and let me know if it works then, so we can figure out a 
solution.

Alex


>>>

Hi Alex,

replacing doesn´t work.
I also did some further investigation and it led me to a different problem, that may be the reason for all this.

I think that the TRY_COMPILE macro of Cmake does not respect the CMAKE_EXECUTABLE_SUFFIX that I have set to ".out".
So the TRY_COMPILE does not find the correctly built output file and further processing fails.

Here´s the output of CMAKE:
-- Check for working CXX compiler: C:/Programme/ARM/RVCT/Programs/4.0/436/multi1/win_32-pentium/armcc.exe
-- Check for working CXX compiler: C:/Programme/ARM/RVCT/Programs/4.0/436/multi1/win_32-pentium/armcc.exe -- works
-- Detecting CXX compiler ABI info
CMake Error: Could not COPY_FILE.
  OutputFile: ''
    copyFile: 'D:/proj/build/test2/CMakeFiles/CMakeDetermineCompilerABI_CXX.bin'

Unable to find executable for try_compile: tried "D:/proj/build/test2/CMakeFiles/CMakeTmp/cmTryCompileExec" and "D:/proj/build
/test2/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec" and "D:/proj/build/test2/CMakeFiles/CMakeTmp/Development/cmTryCompileExec".

-- Suffix is:
-- Output is:

As you can see, I manually added the last to MESSAGEs to the CmakeDetermineCompilerAbi.cmake that was shipped with Cmake 2.8.3.

When I add the line 
SET( CMAKE_EXECUTABLE_SUFFIX .out ) 
In that file, the ABI check seems to work. So the big question is how to make Cmake use the CMAKE_EXECUTABLE_SUFFIX that was given in the toolchain file?

Regards,
Alex



More information about the CMake mailing list