[CMake] problem with SUBDIRS and MingGW-make

Axel Wachtler axel.wachtler at gmx.de
Tue Jul 5 17:20:08 EDT 2005



Axel Wachtler wrote:

>
>
> Cesar Rabak wrote:
>
> > --- Axel Wachtler  escreveu:
> >
> >
> > >Hallo all,
> > >
> > >Environment: cmake 2.0.5; mingw; windwos 2000;
> > >
> > >I use a Top-Level CmakeLists.txt file, which has
> > >a statement:
> > >
> > >   SUBDIRS(../../MyApp ../../MyApp1 )
> > >
> > >The generated GNU-Makefile contains for the
> > >subdirectories
> > >for the "clean" and other (e.g. dependency) targets
> > >rules like:
> > >
> > >clean__MyApp:
> > >    @cd ../../MyApp; $(MAKE) clean
> > >
> > >The problem with MinGW-make is that it does not
> > >handle the ";" correct, so the "$(MAKE) clean" is
> > >not executed in ../../MyApp.
> >
> >
> > I'm afraid your description of the cause is somewhat
> > incorrect:
> >
> > It is not make that does not handle well the ';' but
> > rather the command shell you are using.
>
>
> You are right, command.com is the reason.
>
> So I have not checked for a shell that comes with mingw.
> For cygwin-bash the problem was, the avr-gcc is build
> under mingw and expects DOS filenames, like c:/src/main.c
> but the bash hands over /cygdrive/c/src/main.c, so that
> avr-gcc could not open the file. (you can not mixup
> mingw and cygwin based programs, another issue is, that
> the PATH variable is of importance, because there are some
> tools with equal names in DOS and MinGW but different
> command line options.)
> As soon as I'm back at my Windows Desktop (Tuesday),
> I will try a shell coming with mingw.
>
> > Did you try a unixy shell port to check this?
>
>
> > The root problem IMHO is that for MingW the only
> > option is "Unix Makefile" whereas some checks on the
> > platform's OS could be used to produce Makefiles with
> > the more amenable syntax you propose.
>
>
> Yes, this would cleanly encapsulate the "-C GNUism"
> so that it don't break the make on other Unixes.


Today I figured out what happens really with mingw and cmake
generated makefiles.

It is not the ; - it is the wrong argument for the cd-command
from command.com

@cd c:/src/MyApp

has two incompatibilities, first the drive is not supported,
second the / is not supported.

To troubleshoot this, I tried to postprocess the Makefiles with
a script, but trouble shoots back, because cmake itself is called 
somewhere in the dependency rules :-(

Second approach was to run sh from mingw, but the generated
Makefiles use c:/src but mingw-sh uses /c/src, so it is that
incompatible like with cygwin.

I ended up with removing the SUBDIRS statement from my cmake-files
and wrote a Makefile-Wrapper to build, clean and install all
modules, which was targeted by the SUBDIRS statements before.

Suggestion for fixing the Makefile generator:
if mingw is present, generate make -C c:/src/MyApp (clean|all|install)

Also cmake should have something like a -C option (-C is already in use)
for easy workaround this cd - issue with the Mingw system.

Best Regards

Axel
-- 
------------------------------------------------------------------
Axel Wachtler
Mail:        axel.wachtler at gmx.de
Fingerprint: FA2C 4FB1 AC18 5FA3 F4F1 1114 3F38 E0DF 8C3A DC95
Public Key:  http://www.keyserver.net
------------------------------------------------------------------
Ach lasst doch den Quatsch mit Windows95. Das ist ein ganz normales
Betriebssystem, und es arbeiten echt nette Leute damit."
                                    Peter Berlich in de.talk.bizarre



More information about the CMake mailing list