How to build a universal 32-bit cmake, like the pre-built one they provide for 64-bit?

Kitware provides, but no 32-bit equivalent. The cmake binary in their archive can run on any combination of 64-bit Linux OS and kernel that I am aware of.

I need the same capability for 32-bit Linux: a cmake binary that will run on the modern SLES15 as well as the ancient SLES11.

Does anyone know how Kitware builds the universal 64-bit version? Can it be done with the downloaded source tarball (in spite of “bootstrap” being in the way…)?

If I’m not mistaken, they just use a really old OS to build it. Something like CentOS5 perhaps? Of course that may require to build the entire toolchain, because the standard compiler may be too old to build CMake

You are correct we build on something with a sufficiently old enough version of GLIBC so that it will work everywhere. In your case @ztarem you could build on SLES11 and it will work on all newer versions.

As @jakincai pointed out you might need to get a newish compiler ( GCC 5 ) but that should be doable if you have SP4 SDK for SLES11 iirc.

Hmm. My SLES11 is under strict corporate control, and is only SP1. But I can probably find a suitable vintage Vagrant Linux box. @robert.maynard: Can you recommend a particular Linux brand/release for that?

In my failed attempt, I tinkered with the CMakeLists.txt files to force an almost static link of cmake, ctest and cpack. I suppose that there is no cmake variable or property for that?

Our base is centos 6. CMake now uses a docker image for all our linux x86_64 releases, which you can look at:

Specifically I would look at our initial configuration/toolchain which shows what compilation flags we use to ensure we have static standard library and qt:

Thank you very much. This is very helpful.

See also Utilities/Release/README.rst for an intro to the Docker specification(s) we use for the Linux binaries.

My attempt to build a 32-bit CMake failed because I can’t find 32-bit build tools on a reasonably ancient OS. In particular, the 32-bit build tools for the CentOS you use to build the 64-bit version are no longer available on any public or private repository I could find.

I ended up doing something I really don’t like: I downgraded to CMake release 3.6.3, which was the last one you published with a 32-bit installer. I now cannot use any of the nice things you added to CMake since 2016, just because I have to support 32-bit builds!

Was similary frustrated by this, but now I’ve built a 32 bit version of 3.16.4 using a Dockerfile with FROM i386/ubuntu:18.04 and then just building it from source there.
At least the CMAKE_SIZEOF_VOID_P is 4 :).

I tried a similar approach, but with a suitably ancient OS that has an old version of GLIBC. I need cmake to run on SLES 11, which is from 2010, and still runs kernel 2.6. The distributed 64-bit version of cmake is built that way, but the 32-bit dev tools have long gone from the corresponding package repositories.