[CMake] Newbie questions

Natros natros at gmail.com
Sun Nov 7 05:30:09 EST 2004


On Thu, 04 Nov 2004 15:43:37 -0500, Andy Cedilnik
<andy.cedilnik at kitware.com> wrote:
> Hi Jeff,
> 
> 
> 
> On Thu, 2004-11-04 at 15:15, Jeff Squyres wrote:
> > We are considering changing a relatively large software project away
> > from the GNU tool suite (Autoconf, Automake, Libtool), and cmake was
> > suggested to us.  I've downloaded it, played with it a little bit, read
> > through the documentation and FAQ, and have looked through the last
> > month or two of activity here on the mailing list.  It is my impression
> > that cmake replaces these three tools by doing per-system tests,
> > traversing directories, compiling source files, and building libraries
> > and applications.  It does this by analyzing all the CMakeList.txt
> > files and emitting "native" build instructions (such as VC++ projects,
> > makefiles, etc.).
> 
> Sounds like a good idea.
> 
> > I don't actually care about making a library in each subdirectory (we
> > only do that because it is The Automake/Libtool Way), but being able to
> > invoke "make" in each subdirectory is quite a useful thing.  What is
> > the canonical cmake way having lots of source files dispersed
> > throughout an entire tree (some of which may be conditionally compiled,
> > depending on architecture, etc.) compiled into a single, top-level
> > library?
> 
> If I want to achieve this, I do something like:
> 
> SET(srcs
>   Part1/src1.c
>   Part1/src2.c
>   Part1/src3.c
>   Part2/src1.c
>   Part2/src2.c
>   Part2/src3.c
>   ...
>   PartN/src1.c
>   PartN/src2.c
>   PartN/src3.c
> )
> 
> ADD_LIBRARY(WholeShebang ${srcs})
> 
> The object files will be in subdirectories Part1, Part2, ...

If you use QT_WRAP_CPP in one of those files, the wrapped file and the
object file will be in the parent directory and not in the
subdirectory.

-- 
Natros


More information about the CMake mailing list