[Cmake] Force a generator?

Schumacher, Gordon gordon_schumacher at maxtor.com
Mon, 26 Apr 2004 12:04:48 -0600


Let me clarify a little... I'm using CMake in an unusual circumstance.  Our
application is
portable on both multiple hosts *and* targets; we don't support
"cross-compiling" per se,
but we do as far as CMake is concerned.  That's because one of our target
platforms is
DOS DJGPP, which is 32-bit extended DOS.  I intend to run CMake under
Windows, using the
DOS build tools (and, perhaps someday, explicitly call "i386-msdosdjgpp-gcc"
cross-build
tools, but that's down the road.)  The point is, even running the native
DJGPP "gcc" and
"make", it's still using a Win32 version of CMake... so from CMake's point
of view, it's
a cross-build.

So when I'm saying "target platform", I mean "binary target" - not "host
platform".

Right now, the way I'm doing this is as follows:

cmake -G"Unix Makefiles" -DTARGET:STRING=dos32
or
cmake -G"Visual Studio 6" -DTARGET:STRING=win32

It'd be really nice, though, if code like the following worked (though I
already know that it doesn't):
IF(TARGET MATCHES dos32)
   SET(GENERATOR "Unix Makefiles")
ENDIF(TARGET MATCHES dos32)
IF(TARGET MATCHES dos32)
   SET(GENERATOR "Visual Studio 6")
ENDIF(TARGET MATCHES dos32)

-----Original Message-----
From: Andy Cedilnik [mailto:andy.cedilnik at kitware.com]
Sent: Monday, April 26, 2004 7:16 AM
To: Schumacher, Gordon
Cc: CMake List (E-mail)
Subject: Re: [Cmake] Force a generator?


Hi Gordon,

Actually not.

Take for example Windows and Mac. On Windows, the generator can be
Visual Studio 6, 7, 71, or NMake, or it can be Borland Makefiles, and
Makefiles (for Mingw). So, platform Windows does not say anything.

Same thing will be on Mac, once somebody writes XCode generator. Also,
once somebody writes KDevelop generator, then ...

			Andy

On Fri, 2004-04-23 at 19:46, Schumacher, Gordon wrote:
> Is there a way to force the use of a particular generator?  For the
> application of CMake that I'm after, I need for users to be able to
> pick a *platform*, instead of a *generator* - and from there, the
> generator is pretty well hard-wired.
> 
> I haven't been able to figure out how to do it.  It's not a big deal,  but
> if there's a way to do it, it'd mean less typing for the users...