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

Alexander Neundorf a.neundorf-work at gmx.net
Sat Aug 9 08:10:22 EDT 2008


> and zosport.cmake contains (comments/whitespace stripped):
>
> SET(CMAKE_SYSTEM_NAME "ZOS")
> SET(CMAKE_C_COMPILER   "c:/progra~1/dignus/cc.bat" "-fasciiout")
> SET(CMAKE_CXX_COMPILER "c:/progra~1/dignus/cxx.bat" "-fasciiout")
> SET(CMAKE_CXX_LINK_EXECUTABLE "c:/progra~1/dignus/plink.exe \"- 
Sc:/progra~1/dignus/objs_rent/&M\" <OBJECTS> -o <TARGET>")
> SET(CMAKE_C_LINK_EXECUTABLE   "c:/progra~1/dignus/plink.exe \"-
Sc:/progra~1/dignus/objs_rent/&M\" <OBJECTS> -o <TARGET>")
>
> From reading http://www.cmake.org/Wiki/CMake_Cross_Compiling, it appears
> to me that I need at least the first 3 lines of this.  And since the other
> two lines have paths in them (even with the "progra~1" format in PATH,
> Windows resolves them as "Program Files", so it fails), I don't think it
> makes sense to put them in Modules/Platform.

In Modules/Platform you can rely on having the full path to the compiler, so 
you can use get_filename_component( ... PATH) to get the directory, and then 
use the following to get the full path to the linker:
find_program(PLINK_EXECUTABLE NAMES plink 
                      PATHS ...path from above NO_DEFAULT_PATH)

This would keep the specific path in your toolchain file, and the linker can be 
found in the zos.cmake file.
The two rules for the link command should also go into that file (or zos-
Dignus-C[XX].cmake.

> So I *think* the only contribution to the CVS tree will be the really
> exciting zos.cmake:
>
> INCLUDE(Platform/UnixPaths)

Are you actually sure about this line ?

Alex



More information about the CMake mailing list