[CMake] unexpected INSTALL problems

Dominik Szczerba dominik at itis.ethz.ch
Wed Jun 15 15:52:05 EDT 2011


> The FILES_MATCHING option of INSTALL(DIRECTORY ...) applies to files
> only, i.e. with the above-noted line and BOOST_RUNTIME_DIR==/usr/lib,
> you'll get the *whole* directory structure under /usr/lib including
> symlinks to directories, but only files and symlinks to files which
> match PATTERN/REGEX, copied to DESTINATION. Supposedly, this is
> what you denote "half of my system copied".

I am sure at some point I saw all the files copied over (including
e.g. *.sh files) but I can not reproduce it any longer. Currently it
seems you are right here. INSTALL(DIRECTORY ... NO_RECURSION) would be
a straight forward extension.

> The REGEX should read "libboost.*\\.so.*$" or "libboost.*\\.so.*\$",
> and what do you mean exactly with "does absolutely nothing" and "does

Why would I need double escaping? I did not see any mention of it in
any related documentation/wiki. But even then, it does not work,
please see below for details.

> INSTALL(DIRECTORY /usr/lib/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
> FILES_MATCHING PATTERN "libboost*.so")
>
> as well as
>
> INSTALL(DIRECTORY /usr/lib/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
> FILES_MATCHING REGEX "libboost.*\\.so.*\$")
>
> yield the results expected from the documentation, i.e. the whole but
> shallow directory structure under /usr/lib and the libboost*.so or

The former copies the whole dir structure and matching files only (in
the top dir). Works as in docs but is not what I need. The latter does
not copy ANYTHING, i.e. the result is an empty folder. I still wonder
why.

> Obviously, your approach to copy the Boost libraries from /usr/lib
> using INSTALL(DIRECTORY /usr/lib/ ... FILES_MATCHING ...) is not
> appropriate. Instead, you might use a suitably configured CMake
> script which runs FILE(GLOB ...) or FILE(GLOB_RECURSE ...) and
> FILE(INSTALL|COPY ...) and is invoked by INSTALL(SCRIPT ...).
> In this way, you'll have your project's Boost installation
> done in one go during the project's installation.

The idea to use INSTALL(SCRIPT...) is an interesting workaround, will
try. Still, an option to disable recursion with INSTALL(DIRECTORY...)
would be much cleaner.

Thanks a lot,
Dominik


More information about the CMake mailing list