[CMake] How to set own linker?

Martin Kupke martin.kupke at novero.com
Thu Sep 22 12:09:21 EDT 2011


Hi,

I created a toolchain file for cross compiling in my Windows XP 
environment.
To provide cross compiling functionality I set the CMAKE_SYSTEM_NAME to 
Generic.
The toolchain file contains the variables:
CMAKE_C_COMPILER set to my own wanted compiler, which is dcc.exe
CMAKE_ASM_OCU_COMPILER set to my own wanted assembler, which is das.exe
For both, assembler and compiler I created configuration files in the 
Platform folder.
Up to this point everything goes fine and as wanted, the assembler 
source files with the .s extension are compiled with das.exe and the C 
source files with the extension .c are compiled with the dcc.exe.

In the root top level CMakeLists.txt the instruction
project( EmbeddedProject C ASM_OCU)
ensures that only C compiler and ASM_OCU assembler are called (no CXX).

Even in the root top level CMakeLists.txt I set
add_executable( ${PROJECT_NAME} ${SourceFiles} )
where SourceFiles is a string containing all source files (assembler and C).

I even tried to set the CMAKE_LINKER variable to my own linker, but it 
isn't used.
Where is my fault?

Thanks,
Martin...




More information about the CMake mailing list