[Cmake] CMake 1.4, NMake makefile, problem with "jump over" t o build required lib

Wheeler, Fred (Research) wheeler at crd.ge.com
Wed Jul 31 12:51:20 EDT 2002


> From: Miller, James V (Research) 
> 
> Aren't subdirectories visited in the order in which the SUBDIRS
> command are listed?

This is the default order, but cmake generates makefiles that can cause the build to jump around the
tree to build dependencies.

> Actually, from your email is looks like there is a circular dependency
> on directories
> 
> vtol depends of vdgl
> vdgl/examples depends on vtol

There is a circular dependencies between the vtol directory tree and the vdgl directory tree, but
there are no circular dependencies when we look at specific directories.  Here is some more detail on
the dependencies.  This time, to be more clear, I've listed specific files.

1. vxl/gel/vtol/vtol.lib (depends on vdgl.lib, but only later when linking an exec)
2. vxl/gel/vtol/examples/example2d.exe (depends on vdgl.lib since vtol.lib depends on vdgl.lib) 
3. vxl/gel/vtol/tests/vtol_test_block.exe (depends on vtol.lib)
4. vxl/gel/vdgl/vdgl.lib (does not depend on anything else listed here)
5. vxl/gel/vdgl/examples/example_vdgl.exe (depends on vtol.lib)
6. vxl/gel/vdgl/tests/test_vdgl.exe (depend on vdgl.lib)

There is no dependency problem if the directories are built in the following order,

1. vxl/gel/vtol/vtol.lib (depends on vdgl.lib, but only later when linking an exec)
4. vxl/gel/vdgl/vdgl.lib (does not depend on anything else listed here)
2. vxl/gel/vtol/examples/example2d.exe (depends on vdgl.lib since vtol.lib depends on vdgl.lib)
3. vxl/gel/vtol/tests/vtol_test_block.exe (depends on vtol.lib)
4. vxl/gel/vdgl/examples/example_vdgl.exe (depends on vtol.lib)
5. vxl/gel/vdgl/tests/test_vdgl.exe (depend on vdgl.lib)

I only moved item 4.  CMake produces makefiles with the logic to effectively do this reordering when
needed.

> The answer may be to move the vdgl/examples that depend on vtol into
> the vtol/examples directory.  Then make sure the vdgl is listed before
> vtol in the SUBDIRS commands.

I think this would work, but I also think the real issue is that CMake is designed to handle this
type of situation, but seems to have slightly broken NMake make targets.

Fred Wheeler

> -----Original Message-----
> From: Wheeler, Fred (Research) 
> Sent: Wednesday, July 31, 2002 11:07 AM
> To: CMake List (E-mail)
> Subject: [Cmake] CMake 1.4, NMake makefile, problem with 
> "jump over" to
> build requ ired lib
> 
> 
> I'm having a problem getting VXL to build with CMake-1.4 
> generated win2k
> NMake makefiles in one pass.  In vxl/gel the following directories get
> visited in this order (some others are omitted).
> 
> vxl/gel/vtol (depends on vdgl)
> vxl/gel/vtol/examples (depends on vdgl since vtol depends on vdgl)
> vxl/gel/vtol/tests
> vxl/gel/vdgl
> vxl/gel/vdgl/examples (depends on vtol)
> vxl/gel/vdgl/tests
> 
> Via TARGET_LINK_LIBRARIES commands, vtol depends on vdgl.lib and
> vdgl/examples depends on vtol.  When the build gets to
> vxl/gel/vtol/examples, the objects build fine, but the link to make an
> executable requires vdgl.lib.  So, cmake "jumps" over to vxl/gel/vdgl
> to build vdgl.lib, but this fails.
> 
> The NMake makefile file in vxl/gel/vtol uses the following stanza to
> build vdgl.lib.
> 
> C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl\vdgl$(CMAK
> E_STATICLIB_SUFFIX):
> 	cd C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl
> 	$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.depends
> 	$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.check_depends
> 	$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) -f cmake.check_depends
> 	$(MAKE) $(MAKESILENT)
> C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl\vdgl$(CMAK
> E_STATICLIB_SUFFIX)
> 	cd C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vtol\examples
> 
> Note the full path to vdgl.lib.  In my build from scratch I get the
> following error,
> 
>   ...
>   'cmake.check_depends' is up-to-date
>   'cmake.depends' is up-to-date
>   NMAKE : warning U4010: 
> 'C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl\vdgl.lib' : build
> failed; /K specified, continuing ...
>   ...
> 
> I tried entering the following into a DOS shell.  This is what the
> makefile does.  I've substituted for the make variables.
> 
>   cd C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl
>   nmake /nologo 
> C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl\vdgl.lib
>   cd C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vtol\examples
> 
> But I get this error,
> 
>   NMAKE : fatal error U1073: don't know how to make
> 'C:\cygwin\home\wsroot\work_vl\vxl_bld_win\gel\vdgl\vdgl.lib'
>   Stop.
> 
> There is no make target named
> "C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl\vdgl.lib", but
> there is a target named "vdgl.lib" in gel/vdgl/Makefile.  So, I tried
> removing the full path to vdgl.lib and entered this into the DOS
> shell,
> 
>   cd C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vdgl
>   nmake /nologo vdgl.lib
>   cd C:\cygwin\home\wsroot\work_vxl\vxl_bld_win\gel\vtol\examples
> 
> This built vdgl.lib fine.
> 
> Should the NMake makefile stanzas that "jump over" to a different
> directory to build a library that is needed use the full path to that
> library?
> 
> Everything gets built after a second "nmake" command.
> 
> Thanks,
> Fred Wheeler
> 
> --
> Fred Wheeler, GE CRD, KWC-303
> Phone: 518-387-7225 (GE Internal Dialcom: 8*833-7225)
> Fax:   518-387-4042 (GE Internal Dialcom: 8*833-4042)
> _______________________________________________
> Cmake mailing list
> Cmake at public.kitware.com
> http://public.kitware.com/mailman/listinfo/cmake
> 



More information about the CMake mailing list