On Tue, 2022-02-15 at 16:59 -0600, Bob Friesenhahn wrote:
> The people who tell me it is more portable are very interested in 
> targeting Microsoft Windows.

Unsurprising :).

Just to be clear, cmake can't/won't help you write programs that are
portable to Windows.  If you are targeting the W32 system API, you may
have to modify a lot of code to make it work and cmake will be of zero
assistance to creating this code "portably".  And if you are going to
use a POSIX layer on top of Windows (for example, cygwin) then you have
a POSIX environment already and can just run configure anyway.

If your project is basically pretty portable (doesn't use many system
APIs outside of C and C++ standard runtimes), so that the main problem
is the configure and build systems, then cmake can be a big benefit.

For example, you see a lot of cmake usage in library projects or simple
programs on Git forges, where the code is pretty stand-alone and people
want to make it easy to build on different systems.

> 
> The "Makefiles" that Cmake generates are self-referential in that 
> almost all rules invoke Cmake to do the work.

True; CMake includes a kind of "busybox" set of operations, to increase
portability (so it doesn't have to rely on "echo", "cp", etc. in its
rules, that wouldn't work everywhere).  But, the types of operations it
supports are limited.  It can echo, copy files/directories, make
directories, remove files/directories, rename things, touch files,
create tar files, and generate checksums with builtin operations (and a
few other things).

If you have cmake installed you can run "cmake -E --help" to see a
complete list.

Reply via email to