[CMake] multiple cmake files in one directory

th.tom at gmx.de th.tom at gmx.de
Wed Sep 23 11:05:33 EDT 2009


Hi,

this thread got a bit off topic, so I try to focus that again, as I tried a lot of things, but didn't get it to run:

In the end I would like to have some (lets say 10) packages (Installer bundles, which I can create with cpack) with several executables and libraries. My example over-simplify the problem as I have nearly 60 subdirectories which are all placed into one single CVS repository. One package or "Project" needs sources from a number of subdirectories. One subdirectory is definitivly bound to one project, so there is no overlapping here.

What I tried at last was that I created all the projects within the root CMakeLists.txt file. But this does not make cpack create more than one installer package.

Any ideas about that? Beyond the idea of refactoring the whole project (what is only an option for the far future)


Thanks - tom
  

> On Tue, Sep 22, 2009 at 7:59 PM, Alexander Neundorf
> <a.neundorf-work at gmx.net> wrote:
> > On Tuesday 22 September 2009, Tyler Roscoe wrote:
> >> On Tue, Sep 22, 2009 at 05:55:49PM +0200, th.tom at gmx.de wrote:
> >> > I have seen a thread about this issue but there was not a real
> >> > solution, so I try to ask that again: Is there a way to define a
> >> > specific CMakeLists.txt-file with a cmake call.
> >>
> >> Maybe you should post a link to the thread so we know what you're
> >> talking about?
> >>
> >> > I have two projects, which have the same root directory (what is
> really
> >> > nasty but I can't change it actually):
> >> >
> >> > -data
> >> >   - subdir1
> >> >   - subdir2
> >> >   - subdir3
> >> >
> >> > These two projects need some subdirectories, so the cmake files would
> >> > look like this:
> >> >
> >> > CMakeLists-1.txt: (Project 1)
> >> > [..]
> >> > SUBDIRS(
> >> >    subdir1
> >> >    subdir3
> >> > )
> >> > [..]
> >> >
> >> > and
> >> >
> >> > CMakeLists-2.txt: (Project 2)
> >> > [..]
> >> > SUBDIRS(
> >> >    subdir2
> >> > )
> >> > [..]
> >> >
> >> > I want to build project 1 completly independent from project 2.
> >>
> >> subdirs() is deprecated. Use add_subdirectory().
> >>
> >> You can explicitly tell CMake the name of your list file with something
> >> like cd build && cmake ../MyCMakeLists.myext.
> >
> > I don't think that works.
> >
> >> You could let the CMakeLists in the data directory take care of subdir1
> >> and subdir3 and move the CMakeLists for subdir2 into subdir2.
> >
> > yes, or add subdirs
> > project1-cmake/ and project2-cmake/ and add the CMakeLists.txt for the
> > projects there ?
> 
> What we do in our build system is using file(GLOB to get all .cmake
> files in a "targets" directory, and including those. That way, to add
> additional targets, all the developers have to do is add a .cmake file
> to that directory.
> 
> In the .cmake files themselves, we use a macro to make the file
> optional: we create a cached boolean variable that the developers can
> check/uncheck to enable/disable building of the targets.
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list