[CMake] gathering directory names in cmake

Lee Butler iraytrace at gmail.com
Mon Jun 20 14:47:32 EDT 2016


I have a source tree which contains multiple directories each of which 
has a subdirectory called "xyz".  I want to create a target that creates 
a zip file with each of the xyz directories.  So if the source tree 
looks like
   src
   src/xyz
src/application
src/application/xyz
src/plugins/one/xyz

I want to end up with a zip file containing:
    src/xyz/*
src/application/xyz/*
src/plugins/one/xyz/*

On unix I could just generate the list of these directories with:
   find src -type d -name test -print
alas, I need a cross-platform way to do this.

I tried:
   file(GLOB_RECURSE XYZFILES "${CMAKE_SOURCE_DIR}/src/*xyz)
and got nothing.

At the moment, it looks like I cannot wildcard any portion of the 
directory path.  The following:
   file(GLOB_RECURSE XYZFILES "${CMAKE_SOURCE_DIR}/src/*xyz*")
seems to only produce files which have xyz in their name.

Lee


More information about the CMake mailing list