[CMake] Cross-compiling for z/OS -- linker question

Phil Smith phil at voltage.com
Tue Aug 5 17:03:02 EDT 2008


Re the link command, thanks:
        SET(CMAKE_C_LINK_EXECUTABLE   "c:/progra~1/dignus/linkit.bat -o ./<TARGET> <OBJECTS>")
seems to be working much better!

As for the ForceCompiler stuff, I think I understand what you're getting at, but am reluctant to be quite that pure since it's likely to require a bunch more tinkering.  For historical reasons, Dignus is really, really unlikely to add any more compilers, and are equally unlikely to support any other hardware platforms.  Also for historical reasons, the various IBM OSes for z are interoperable, so the OS doesn't seem relevant.  I hate everything I've just written -- I believe strongly in the purity of such things, having been burned far too often by folks NOT bothering -- but find myself unwilling to make the investment this time.

...phsiii

-----Original Message-----
From: Alexander Neundorf [mailto:a.neundorf-work at gmx.net]
Sent: Tuesday, August 05, 2008 3:57 PM
To: cmake at cmake.org
Cc: Phil Smith
Subject: Re: [CMake] Cross-compiling for z/OS -- linker question

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