<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Alas, this has no effect. Consider the following shell script:<br>
<br>
-----------------------------------------------------------------<br>
#!/bin/sh<br>
if [ -d attempt ] ; then rm -rf attempt ; fi<br>
mkdir attempt<br>
cd attempt<br>
for d in src src/app src/plugins/one ; do<br>
mkdir -p $d/xyz<br>
touch $d/xyz/one.txt<br>
touch $d/xyz/two.txt<br>
done<br>
PATTERN="\${CMAKE_SOURCE_DIR}/src/*xyz/"<br>
<br>
cat > CMakeLists.txt <<EOF<br>
project(gatherdir)<br>
cmake_minimum_required(VERSION 3.0)<br>
<br>
file(GLOB_RECURSE xyzDirs "${PATTERN}")<br>
message(STATUS "____look for ${PATTERN}")<br>
message(STATUS "____xyzDirs: \${xyzDirs}")<br>
EOF<br>
cmake .<br>
---------------------------------------------------------------------<br>
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.<br>
<br>
<div class="moz-cite-prefix">On 6/22/2016 10:52 AM,
<a class="moz-txt-link-abbreviated" href="mailto:cmake-request@cmake.org">cmake-request@cmake.org</a> wrote:<br>
</div>
<blockquote cite="mid:mailman.902.1466607140.17623.cmake@cmake.org"
type="cite">
<pre wrap="">On Mon, Jun 20, 2016 at 8:47 PM, Lee Butler <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:iraytrace@gmail.com"><iraytrace@gmail.com></a> wrote:
</pre>
<blockquote type="cite" style="color: #000000;">
<pre wrap=""><span class="moz-txt-citetags">> </span>I have a source tree which contains multiple directories each of which has
<span class="moz-txt-citetags">> </span>a subdirectory called "xyz". I want to create a target that creates a zip
<span class="moz-txt-citetags">> </span>file with each of the xyz directories. So if the source tree looks like
<span class="moz-txt-citetags">> </span> src
<span class="moz-txt-citetags">> </span> src/xyz
<span class="moz-txt-citetags">> </span>src/application
<span class="moz-txt-citetags">> </span>src/application/xyz
<span class="moz-txt-citetags">> </span>src/plugins/one/xyz
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>I want to end up with a zip file containing:
<span class="moz-txt-citetags">> </span> src/xyz/*
<span class="moz-txt-citetags">> </span>src/application/xyz/*
<span class="moz-txt-citetags">> </span>src/plugins/one/xyz/*
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>On unix I could just generate the list of these directories with:
<span class="moz-txt-citetags">> </span> find src -type d -name test -print
<span class="moz-txt-citetags">> </span>alas, I need a cross-platform way to do this.
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>I tried:
<span class="moz-txt-citetags">> </span> file(GLOB_RECURSE XYZFILES "${CMAKE_SOURCE_DIR}<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>src<span class="moz-txt-tag">/</span></i>*xyz)
<span class="moz-txt-citetags">> </span>and got nothing.
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>At the moment, it looks like I cannot wildcard any portion of the
<span class="moz-txt-citetags">> </span>directory path. The following:
<span class="moz-txt-citetags">> </span> file(GLOB_RECURSE XYZFILES "${CMAKE_SOURCE_DIR}<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>src<span class="moz-txt-tag">/</span></i><b class="moz-txt-star"><span class="moz-txt-tag">*</span>xyz<span class="moz-txt-tag">*</span></b>")
<span class="moz-txt-citetags">></span>
</pre>
</blockquote>
<pre wrap="">what about adding a backslash at end of expression ?
file(GLOB_RECURSE XYZFILES "${CMAKE_SOURCE_DIR}<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>src<span class="moz-txt-tag">/</span></i>*xyz/")
seems to only produce files which have xyz in their name.
</pre>
<blockquote type="cite" style="color: #000000;">
<pre wrap=""><span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Lee
<span class="moz-txt-citetags">> </span>--
<span class="moz-txt-citetags">></span>
<div class="moz-txt-sig">--
Regards,
Rashad</div></pre>
</blockquote>
</blockquote>
<br>
</body>
</html>