[CMake] subdirectories INSTALL(FILES "subdir/foo.h" ...)

Brad King brad.king at kitware.com
Fri Jun 30 13:30:49 EDT 2006


Jan Woetzel wrote:
> Hi,
> I expected
>  INSTALL(FILES  "subdir/foo.h" DESTINATION include )
> 
> to install "foo.h" into
> include/subdir but it installs into:
> include
> Thus the subdirectory structure is lost.
> 
> (1) This is a bug or am I missing something ?
> 
> It works if I put the approppritae DESTINATION into each subdirectories 
> CMakeLists.txt it works.
> But I want to use a globbing expression to install all headers keeping 
> their subdirectory structure to avoid forgetting to ad dthem.
> 
> I'm using Cmake 2.4.2 on Windows (with MSVS 7.1 generator).

This is the expected behavior.  The FILES option is meant to list the 
exact files that should be installed to the given destination regardless 
of source location.  You can probably do what you want in CMake code 
with a combination of FILE(GLOB) and IF(IS_DIRECTORY).

What is missing is an INSTALL(DIRECTORY ...) option.  There is a feature 
request already in the bug tracker for this but it has not yet been 
implemented.

-Brad


More information about the CMake mailing list