Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing certain files with CMake

Tags:

svn

cmake

I have a source directory structure:

projectSource
|---src
|---include
|---CMakeLists.txt

and would like an install directory structure of

projectInstall
|---bin
|---include
|---lib

My source directory tree is all under version control, so each source folder contains an additional .svn/ directory. What's the easiest way to install all header files from projectSource/include to projectInstall/include, while skipping over the .svn directories?

I'd like to use something like:

set( PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include )
include_directories( ${PROJECT_INCLUDE_DIR} )
install(DIRECTORY ${PROJECT_INCLUDE_DIR}/
    DESTINATION "include"
    FILES_MATCHING PATTERN "*.h"
    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)

but even though I'm (attempting to) install only files matching *.h, I'm still picking up the .svn/ directory and contents.

like image 863
Chris Avatar asked Dec 19 '11 10:12

Chris


1 Answers

You can add EXCLUDE keyword to the PATTERN:

install(DIRECTORY ${PROJECT_INCLUDE_DIR}/
    DESTINATION "include"
    FILES_MATCHING
    PATTERN "*.h"
    PATTERN ".svn" EXCLUDE
    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
like image 70
arrowd Avatar answered Oct 09 '22 06:10

arrowd