[CMake] Cross-compiling for z/OS -- linker question
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Aug 5 15:57:22 EDT 2008
Hi,
On Tuesday 05 August 2008, Phil Smith wrote:
> Next issue: linking. I have a toolchain file now that looks like this:
>
> ------------------------------------------------------------
> # Tell CMAKE the target system name
> SET(CMAKE_SYSTEM_NAME "ZOS")
>
> # Specify the cross-compilers
> SET(CMAKE_C_COMPILER "c:/progra~1/dignus/cc.bat")
> SET(CMAKE_CXX_COMPILER "c:/progra~1/dignus/cxx.bat")
>
> # Linker
> SET(CMAKE_CXX_LINK_EXECUTABLE "c:/progra~1/dignus/linkit.bat")
> SET(CMAKE_C_LINK_EXECUTABLE "c:/progra~1/dignus/linkit.bat")
These two variables should contain the full command to link an executable, not
only the actual tool, see e.g. Modules/Platform/eCos.cmake for an example
with a quite custom link command or Modules/CMakeCInformation.cmake for the
default settings
> INCLUDE (CMakeForceCompiler)
> CMAKE_FORCE_C_COMPILER (c:/progra~1/dignus/cc.bat Dignus)
> CMAKE_FORCE_CXX_COMPILER (c:/progra~1/dignus/cxx.bat Dignus)
> ------------------------------------------------------------
>
> (I'm actually likely to change all "ZOS" to "DIGNUS", since it's really not
> specific to z/OS, but rather to System z -- but that's for later.)
Well, the initial tests for the compiler should work without the
CMakeForceCompiler stuff. If this works, then CMakeC[XX]CompilerId.c.in cmake
should be able to detect that it's the Dignus compiler, and set
CMAKE_C_COMPILER_ID to "Dignus". Once this is works, it then tries to load
Modules/Platform/ZOS-Dignus-C.cmake (and ZOS-Dignus-CXX.cmake).
These files should then contain the settings which are specific for that
combination of operating system, and compiler.
E.g CMAKE_C_LINK_EXECUTABLE and maybe more.
> CMAKE calls cc.bat correctly for CheckInclude and CheckTypeSizeC. But then
> it calls linkit.bat with NO operands -- so linkit has no idea what it's
> supposed to linkedit! What am I missing?
See above.
Alex
More information about the CMake
mailing list