Alas, this has no effect.  Consider the following shell script:

-----------------------------------------------------------------
#!/bin/sh
if [ -d attempt ] ; then rm -rf attempt ; fi
mkdir attempt
cd attempt
for d in src src/app src/plugins/one ; do
    mkdir -p $d/xyz
    touch $d/xyz/one.txt
    touch $d/xyz/two.txt
done
PATTERN="\${CMAKE_SOURCE_DIR}/src/*xyz/"

cat > CMakeLists.txt <<EOF
project(gatherdir)
cmake_minimum_required(VERSION 3.0)

file(GLOB_RECURSE xyzDirs "${PATTERN}")
message(STATUS "____look for ${PATTERN}")
message(STATUS "____xyzDirs: \${xyzDirs}")
EOF
cmake .
---------------------------------------------------------------------
I cannot find any string that PATTERN can be which will cause xyzDirs to have the names of the three "xyz" directories. I could search for *xyz/* but now I have to edit the list to remove file names, remove doubles from the result, etc.

On 6/22/2016 10:52 AM, cmake-requ...@cmake.org wrote:
On Mon, Jun 20, 2016 at 8:47 PM, Lee Butler<iraytr...@gmail.com>  wrote:

>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*")
>
what about adding a backslash at end of expression ?
    file(GLOB_RECURSE XYZFILES "${CMAKE_SOURCE_DIR}/src/*xyz/")


seems to only produce files which have xyz in their name.
>
>Lee
>--
>
-- Regards, Rashad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to