NerdGGuy
NerdGGuy

Reputation: 139

Using toolchain file for different build host

I want to adopt CMake for builds in a controlled build environment but will not be able to install CMake on these systems. I have seen resources detailing how to cross compile using a toolchain file (https://cmake.org/Wiki/CMake_Cross_Compiling).

Would it be possible to use this technique to run CMake on one system to build makefiles to be used on a different build host? Are there any resource available detailing any pitfalls? I will be generating makefiles on Linux for many platforms from Arm Linux to z/OS.

Upvotes: 0

Views: 403

Answers (1)

Florian
Florian

Reputation: 42842

Turning my comments into an answer

  1. "Cross-Compiling" for CMake means there has to be the "Cross-Compiler" installed on your PC/OS running CMake to generate the environment.

    So no, you can't generate e.g. makefiles for another PC/OS environment.

  2. You can't move CMake generated build trees somewhere else.

    See CMake's FAQ: Why does CMake use full paths, or can I copy my build tree?

Note: You don't need to install CMake. It's self-contained and can run e.g. from a source control image. So you don't need to have administrative rights to run CMake.

Upvotes: 1

Related Questions