[cmake-developers] strange problem with try_compile

Alexander Neundorf neundorf at kde.org
Fri Aug 27 12:01:12 EDT 2010


Hi,

I'm having problems getting the IAR compiler to work under cmake (I don't have 
the compiler, I don't have windows).

The thing is, the "Check if C compiler works" step fails. This is in 
CMakeError.log:

"Linking C executable cmTryCompileExec.elf"
CMAKE_IAR_LINKER-NOTFOUND "CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj"   
   --configD:/Src/Embedded/KNX/stm32_knx_device/v1.0.0.0/etc/workspace/make/stm32f10x_flash_knx_dynalite_appl.icf
   --redirect _Scanf=_ScanfSmall --map CMAKE_TRY_COMPILE.map
   --entry __iar_program_start    -o cmTryCompileExec.elf
'CMAKE_IAR_LINKER-NOTFOUND' is not recognized as an internal or external 
command, operable program or batch file.


So the problem here is that ${CMAKE_LINKER} is resolved 
to "CMAKE_IAR_LINKER-NOTFOUND".

IAR-C.cmake has:
SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <OBJECTS> <CMAKE_C_LINK_FLAGS>
                             <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>"


In IAR.cmake (included by IAR-C.cmake) I have:
FIND_PROGRAM(CMAKE_IAR_LINKER ilinkarm HINTS "${_CMAKE_TOOLCHAIN_LOCATION}" )
...
SET(CMAKE_LINKER ${CMAKE_IAR_LINKER} CACHE FILEPATH "The IAR linker" FORCE)

In the CMakeCache.txt there is:
hammer:~/src/CMake/tests/IAR-problem-hassan$ grep LINKER: CMakeCache.txt
CMAKE_IAR_LINKER:FILEPATH=D:/Program Files/IAR Systems/Embedded Workbench 
5.5/arm/bin/ilinkarm.exe
CMAKE_LINKER:FILEPATH=D:/Program Files/IAR Systems/Embedded Workbench 
5.5/arm/bin/ilinkarm.exe

So it has been found.
What can be going wrong that <CMAKE_LINKER> is NOTFOUND in the test for the C 
compiler ?

(I already asked for the build tree with --debug-trycompile, but somehow the 
CMakeTmp/ directory he sent me was again empty).

Alex




More information about the cmake-developers mailing list