[CMake] Cmake: INSTALL not working with subdirectories

Otavio Rodolfo Piske angusyoung at gmail.com
Wed Jan 17 06:18:46 EST 2007


Hi Eric,

On 1/17/07, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2007/1/16, Otavio Rodolfo Piske <angusyoung at gmail.com>:
> > Hi,
> >
> > I almost solve the problem! I took a closer look at my top-level
> > CMakeLists.txt and could find it referencing to a directory that it
> > shouldn't. After I commented it, it now installs the files of the last
> > one of the processed modules in the top-level CMakeLists.txt. If you
> > take a look at it (available at
> > http://svn.angusyoung.org/nus/CMakeLists.txt ) you'll notice the last
> > module to be added is MODULE_XML ... so now I have the following
> > output of make install:
> >
>
> [..]
>
> >
> > What I could note in the file cmake_install.cmake is the following comment:
> >
> > #  Install script for directory: /home/otavio/projects/nus/./src/xml
> >
> > The directory /home/otavio/projects/nus/./src/xml is where is the
> > CMakeLists.txt file for the XML module.
> >
> > Any ideas? Thanks in advance!
> >
>
> Could you explain us why you
>
> ADD_SUBDIRECTORY(
>                 src/network
>                 .
>         )
>
> instead of
> ADD_SUBDIRECTORY(
>                 src/network
>         )
>
> do you really want "." (dot) to be the binary_dir for the specified
> subdir?

When I was originally moving from the old build tree to this one, I
received a messaged about not having defined a binary_dir (or, at
least, something very similar to that).
Since you noted that I removed the 'binary_dir' option from
ADD_SUBDIRECTORY and everything seems to be fine. I still have to test
this on windows, though.

>
> I don't know if it is related to your problem but it seems an odd choice to me.
>
> Moreover I don't really understand what are your remaining problems?
> What should be installed and is not?

Eric, my problem is that if I do this:

ADD_SUBDIRECTORY(
   src/a
)

ADD_SUBDIRECTORY(
   src/b
)

ADD_SUBDIRECTORY(
   src/c
)

only the contents of the directory src/c will be installed.

I temporally solved the problem by doing the following :

1) I created a deploy directory with 2 files:
 - a CMakeLists.txt that will include any module that should be
installed. So, each module has a CMakeInstall.txt file that is
included by this one. You can see what I'm talking about here:
http://svn.angusyoung.org/nus/deploy/CMakeLists.txt

- a CMakeInstall.txt with the macros that will install the files:
http://svn.angusyoung.org/nus/deploy/CMakeInstall.txt

2) Then, for each module I created a CMakeInstall.txt file that calls
the installation macros to install its files. Again, you can see it
here: http://svn.angusyoung.org/nus/src/network/CMakeInstall.txt

3) On the top-level CMakeLists.txt file I added the deploy directory
to end of the file.

So, to make it short: my problem seems to be that CMake overwrites
cmake_install.cmake each time it runs ADD_SUBDIRECTORY, so making it
generate installation scripts for only the last of the added
directories.

P.S.: sorry I'm not clear enough, english isn't my primary language.

Thanks in advance
-- 
Otavio R. Piske - AngusYoung
 www.angusyoung.org


More information about the CMake mailing list