[Cmake] Proper way to embed or nest a separate project into another project?

Eric Wing ewing2121 at yahoo.com
Fri, 12 Mar 2004 13:40:57 -0800 (PST)


Can somebody explain to me the "proper" or recommended
method of embedding or nesting a separate project into
a larger project?

More specifically, my project builds an executable
that depends on the Lua library. Lua is small enough
that I can include it with my project source. However,
Lua may already be preinstalled on some systems. So in
a nut shell, I would like to detect for Lua and link
if preinstalled, otherwise build and link to the one
that comes with my project (or give the user the
option).

So to start with, Lua doesn't have a built in CMake
build project. I suppose I could add one fairly easily
because it's a pretty simple build system. I'm looking
at embedding Lua in several other projects I have too,
so I think it would be in my interest to write a
standalone CMake build system for Lua rather than
build one specialized integrated system. In this case,
each of my projects will need to somehow interface
with that Lua project. 

Can somebody explain to me how to actually do this?

And out of curiosity, hypothetically, if I had some
other external project that used autoconf and wasn't
so easy to build a CMake project for, would it be
possible to leverage their native build system
directly?

Thanks,
Eric