[CMake] Install of library sub-project prior to building application

Tyler Roscoe tyler at cryptio.net
Wed Jun 17 15:22:24 EDT 2009


On Wed, Jun 17, 2009 at 11:20:01AM -0700, Richard Offer wrote:
> make install in the Poco build directory.

Does Poco build with CMake, or with something else (autotools)?

> However a make install from the top level doesn't work since it seems its
> trying to build all the code first and then install it - rather than a
> phased approach of make install for each component.

I would expect any build system to know that if I type "make install", I
want it to satisfy all the dependencies of the "install" target, then do
the work associated with the "install" target. So the behavior you see
is exactly what I would expect.

What would you expect "make install" to do if you haven't built all the
parts yet? Just abort immediately? Pick some random .cpp files and
rename them to .dll and copy those? :)

> In previous build systems I've written I have used the phased approach -
> make headers; make exports; make ; make installer
> 
> where headers installs all the headers for the entire build, exports builds
> all the libraries, make then builds all the binaries and make installer
> builds the installer/packages.
> 
> Is that normal in CMake ? Or is there a better way ?

That seems like a lot of work to me. I would just have my "default"
target (whatever you get when you just run "make") depend on headers and
exports so that typing "make" effectively causes "make headers" and
"make exports" to happen.

Note that CMake's INSTALL target (which runs the rules you define with
the install() command) isn't a "real" target so unfortunately you can't
do things like

    add_dependencies(INSTALL myLib1 ... mylibN)

There is an request in the tracker to address this shortcoming.

hth,
tyler


More information about the CMake mailing list