Regular expression in CMake install command


I have a folder with mixed source (.cpp) and header (.h and .hpp) files. How do I write a regex expression in the CMake install command for installing only header files into a specific destination?

My search for an example on how to use a regex expression in the CMake install command did not succeed.


From <a href="http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:install" rel="nofollow">install documentation</a>:


The FILES_MATCHING option may be given before the first match option to disable installation of files (but not directories) not matched by any expression.

</blockquote> <h3>Usage</h3> cmake_minimum_required(VERSION 2.8) project(foo) install( DIRECTORY "./src" DESTINATION "include/foo" FILES_MATCHING PATTERN "*.hpp" ) <h3>Example</h3> > cmake -H. -B_builds -DCMAKE_INSTALL_PREFIX=`pwd`/_install > cmake --build _builds/ --target install > find src/ -type f src/a.hpp src/a.cpp src/B/b.hpp src/B/b.cpp

Only *.hpp files installed:

> find _install/ -type f _install/include/foo/src/a.hpp _install/include/foo/src/B/b.hpp


  • Regex and textmatching issue
  • Extract particular values from string as distinct variables
  • Height 100% not working for nested div
  • Identifying that a property's value is an array
  • Inserting large graph data into Neo4j using py2neo WriteBatch
  • webpack doesn't recognise output file name
  • webpack doesn't recognise output file name
  • How to get Sprite pixel alpha information in cocos2d js/c++
  • JSON Data changes while transferring from C# to ExtJS
  • Extract business titles and time periods from string
  • jQuery: remove the closest with a dynamically added button
  • Where can I find a good tutorial to start programming using Cocos2D-x? [closed]
  • Setting up Redis on Azure cloud service worker role
  • Installed a plugin on eclipse (mars), now eclipse won't start. How can I uninstall the plugin?
  • How atomic are mongoengine's operations
  • Complicated COUNT query in MySQL
  • How to retrieve Business Component rows in SIebel Open UI PM?
  • Listen to the 'change' even of an element in the shadow DOM
  • Sum values in array of hash if they have the same value
  • Google Maps api v3 get start and end coordinates of a street
  • Should I or shouldn't I use the CachingConnectionFactory with hornetq 2.4.1
  • How to define custom class, title, and target in Link Browser for content elements and the new rte_c
  • How do I access an unhandled exception in an MVC Error view?
  • Swift: Switch statement fallthrough behavior
  • How to test if a URL from an Eclipse bundle is a directory?
  • Google Custom Search with transparent background
  • Insert into database using onclick function
  • What is Eclipse's Declaration View used for?
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Java applet as stand-alone Windows application?
  • Can I make an Android app that runs a web view in Chrome 39?
  • vba code to select only visible cells in specific column except heading
  • Jquery - Jquery Wysiwyg return html as a string
  • Matrix multiplication with MKL
  • SQL merge duplicate rows and join values that are different
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • Reading document lines to the user (python)
  • Converting MP3 duration time
  • To Get the radio button value in ruby on rails