[CMake] install command installing symbolic links rather than files

Eric Noulard eric.noulard at gmail.com
Thu May 17 18:18:52 EDT 2012


2012/5/17 EXT-York, Gantry <gantry.york at boeing.com>:
> In our build tree, we have symbolic links to COTS libraries located
> elsewhere.  When we do the install, it copies these symbolic links into the
> run tree when we would actually like a copy of the source of these links
> (the file) in the run tree.

What is "the run tree"? The tree resulting from installation?

I don't think that having a symlink to external in build tree is a
good practice,
why are you doing that?

May be you could
1) configure_file(....    COPYONLY) the COTS lib instead of symlink

or
2) use an IMPORTED library using:
add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED)
set_property(TARGET <name> PROPERTY IMPORTED_LOCATION /path/to/name)

cmake --help-command add_library
http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets

> Is there a way to make the install command copy the file that is the source
> of the symbolic link rather than the symbolic link itself?

I don't think so, if you want that I think you should copy the target at
CMake time as in suggested in method 1).

If you want to "bundle" those external libs with your software,
may be you should have a look at BundleUtilities.cmake
cmake --help-module BundleUtilities

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list