<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
On 8/27/10 9:17 AM, Kevin Fitch wrote:
<blockquote
cite="mid:AANLkTi=7TTuvy6AdcAGt4gEQd0=ABzx2JUTQx6NCDdOF@mail.gmail.com"
type="cite">I am running into an issue that causing me a bit of
trouble:
<div>file(GLOB globOutput test)</div>
<div>returns the absolute path to test (assuming there is a test
directory under my current dir). Whereas</div>
<div>file(GLOB globOutput .)</div>
<div>returns an empty string. This is particularly annoying
because </div>
<div>file(GLOB globOutput non-existant-dir)</div>
<div>also returns an empty string. </div>
<div><br>
</div>
<div>And the follow on to this is that the documentation for
IS_DIRECTORY, EXISTS, ... says:</div>
<div>
<div> Behavior is well-defined only for full paths.</div>
</div>
<div>What exactly does that mean? Just to clarify, is a "full
path" an absolute path (e.g. as determined by IS_ABSOLUTE)? The
only way I have found to get an absolute path is to use
file(GLOB which works for anything other than .</div>
<div><br>
</div>
<div>Kevin Fitch</div>
<br>
</blockquote>
I'd suggest not using file(GLOB in general, and especially for this
purpose or for creating lists of source files.<br>
<br>
If you want to know the directories involved in the build, use:<br>
<ul>
<li>CMAKE_SOURCE_DIR</li>
<ul>
<li><a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_SOURCE_DIR">http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_SOURCE_DIR</a></li>
</ul>
<li>CMAKE_BINARY_DIR</li>
<ul>
<li><a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_BINARY_DIR">http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_BINARY_DIR</a><br>
</li>
</ul>
<li>CMAKE_CURRENT_SOURCE_DIR</li>
<ul>
<li><a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CURRENT_SOURCE_DIR">http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CURRENT_SOURCE_DIR</a></li>
</ul>
<li>CMAKE_CURRENT_BINARY_DIR</li>
<ul>
<li><a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CURRENT_BINARY_DIR">http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CURRENT_BINARY_DIR</a></li>
</ul>
</ul>
To get an absolute path, do the following:<br>
<br>
get_filename_component(outputvar "somedir" ABSOLUTE)<br>
<a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/cmake-2-8-docs.html#command:get_filename_component">http://cmake.org/cmake/help/cmake-2-8-docs.html#command:get_filename_component</a><br>
<br>
Hope this helps!<br>
<br>
Ryan<br>
<pre class="moz-signature" cols="72">--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University
<a class="moz-txt-link-freetext" href="http://academic.cleardefinition.com/">http://academic.cleardefinition.com/</a></pre>
</body>
</html>