[CMake] install(DIRECTORY . DESTINATION include/proj FILES_MATCHINGPATTERN "*.h")

Tyler Roscoe tyler at cryptio.net
Wed Oct 28 11:41:41 EDT 2009


On Wed, Oct 28, 2009 at 04:28:51PM +0100, Mathieu Malaterre wrote:
> I do not understand why I need to explicitely state
> 
>   PATTERN ".svn" EXCLUDE
> 
> (what if tomorrow I switch to CVS, git, or mercurial), so I reverted

Then you use 'PATTERN "${my_vcs_dir}" EXCLUDE' instead.

> file(GLOB header_files "*.h" "*.txx")
> install(FILES ${header_files}
>   DESTINATION include/proj COMPONENT Headers
>   )

This is a bad practice because then CMake has no way to know if there
are new header files and can't regenerate/install correctly. Ok maybe a
new header coming in will happen to trigger a rerun of CMake because the
header happens to belong to one of your built libraries or executables,
but I think this solution is more dangerous than just excluding .svn
explicitly.

tyler


More information about the CMake mailing list