[CMake] Interference between siblings
Weiguang Guan
guanw at rhpcs.mcmaster.ca
Fri Oct 8 15:33:13 EDT 2004
On Fri, 8 Oct 2004, Brad King wrote:
> Weiguang Guan wrote:
>
> > Hi CMake users,
> >
> > Variables, include paths, library paths, etc. are inherited from top-level
> > directory to subdirectories. If we follow this philosophy sibling
> > directories shouldn't affect one another. However, I find this is not the
> > case.
> >
> > I have a source tree, which looks like
> >
> > src
> > / libraries
> > / vtk
> > / itk
> > / ...
> > / apps
> > / app1
> > / app2
> >
> > where CMakeLists.txt in a non-leaf directory contains nothing but
> > SUBDIRS(...). Then I create a directory 'build' to be the root of build
> > tree. In the build directory I ccmake ....../src, then the build tree is
> > generated, which looks like
> >
> > build
> > / libraries
> > / vtk
> > / itk
> > / ...
> > / apps
> > / app1
> > / app2
> >
> > Take the Makefile for app1 as an example. It is different from the
> > Makefile generated by using ccmake ....../src/apps/app1.
>
> This is because CMake never looks above the directory specified as the
> top level source tree. In your example when you specify src/apps/app1
> as the source tree then it does not inherit any settings from
> src/CMakeLists.txt or src/apps/CMakeLists.txt. When you specify src as
> the source tree then app1 gets all those settings.
>
> -Brad
>
I mentioned in my last email that src/CMakeLists.txt and
src/apps/CMakeLists.txt contain nothing but SUBDIRS.
Weiguang
More information about the CMake
mailing list