[CMake] Explanation of the CMake INSTALL and EXPORT Commands

Saad Khattak saadrustam at gmail.com
Wed Apr 3 16:16:08 EDT 2013


Hi,

I am having a hard time understanding some commands in CMake which by the
looks of it are vital for proper project deployment. One of the commands is
INSTALL and the other is EXPORT.

I have read the following page many times:
http://www.cmake.org/Wiki/CMake:Install_Commands. The article states "CMake
has an elaborate install process that simplifies installation of programs,
libraries, and other files." but does not go into any further detail on how
it simplifies the process.

But it seems like the article is meant for CMake veterans and not
newcomers. It simply explains the usage of the command but not what it
does, its end result and its usage. I have the following questions:

1) Why do I need to install my library/executable? When I build my
libraries and they are put in their library output paths, what is the point
of INSTALL?
2) Once I do install targets and/or programs, are they available to other
projects that are not in the same CMakeLists build?
3) Suppose I have 2 completely separate projects (i.e. they have completely
separate CMakeLists that are not 'talking' to each other) - Project A
builds some libraries which Project B now needs to use. Does Project A
'install' the libraries and are now those libraries are available system
wide? Or do I still have to give the path of Project A to Project B for
linking? Perhaps I am not making any sense whatsoever. I apologize, but I
have spent the past week trying to wrap my head around INSTALL and EXPORT
but they make no sense to me because their end-usage is not described
anywhere.
4) Project A can build 32 bit and 64 bit libraries. How does INSTALL (or
EXPORT? Like I said earlier, I am very confused here...) know which library
it is 'installing'? And then how does Project B 32 bit know to link with
Project A 32 bit libraries and same with 64-bit?

Thank you for any help,
Saad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130403/f0a567ca/attachment.htm>


More information about the CMake mailing list