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

Phil Smith phil at voltage.com
Mon Aug 25 15:49:22 EDT 2008


I'm back on this, after a week at a conference and a week of vacation.

I have the GET_FILENAME_COMPONENT call working, and it returns what I'd expect (c:/progra~1/dignus), but the FIND_PROGRAM resolves the path with blanks (c:/Program Files/Dignus/plink.exe).  Here's the CMAKE code I'm using, in ZOS.cmake:

GET_FILENAME_COMPONENT(PLINKPATH "${CMAKE_C_COMPILER}" PATH)
MESSAGE(STATUS "PLINK path is ${PLINKPATH}!")
FIND_PROGRAM(PLINK_EXECUTABLE NAMES plink PATHS "${PLINKPATH}" NO_DEFAULT_PATH)
MESSAGE(STATUS "PLINK_EXECUTABLE is ${PLINK_EXECUTABLE}!")
SET(CMAKE_CXX_LINK_EXECUTABLE "${PLINK_EXECUTABLE} \"-Sc:/progra~1/dignus/objs_rent/&M\" <OBJECTS> -o <TARGET>")
SET(CMAKE_C_LINK_EXECUTABLE   "${PLINK_EXECUTABLE} \"-Sc:/progra~1/dignus/objs_rent/&M\" <OBJECTS> -o <TARGET>")

That barfs all over the place. The two MESSAGE calls show:
-- PLINK path is c:/progra~1/dignus!
-- PLINK_EXECUTABLE is C:/Program Files/Dignus/plink.exe!
(And if I put the "progra~1"-format path back in manually, it works again.)


You're right about the INCLUDE line, btw -- I had put it in as a minimal entry, but I see that it's useless to me.


I also realized that I think there will be a change needed to CheckTypeSize.cmake after all: the -fasciiout flag only makes sense during that call, as during actual compiles, one will NOT want it set.  Something like (around line 60):
    IF(ZOS)
      SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -fasciiout")
    ENDIF(ZOS)


Finally, I'm also still trying to figure out how to name things most correctly.  You said a couple of things before:
>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.

and:
> No, it's <SYSTEM>-<COMPILER_ID>-<LANGUAGE>.cmake
>with SYSTEM being the name of the operating system.

But what I don't see is how it's going to figure out that the compiler is named Dignus, since the CMAKE_FORCE_C_COMPILER stuff breaks everything. Maybe I don't care that much that the compiler gets identified fully -- do I?  It's the one and only likely compiler to be used for z, now and forever (famous last words, I know...).  At least, if any other got used, it would likely be gcc or some other, already-identifiable compiler.  What's the real benefit of identifying it, when I can get it to work as-is?

...phsiii
-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Alexander Neundorf
Sent: Saturday, August 09, 2008 8:10 AM
To: cmake at cmake.org
Subject: Re: [CMake] Cross-compiling for z/OS -- linker question

> 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

_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list