No subject


Mon Dec 15 09:51:36 EST 2008


<br>
All CMake commands<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;=95 find_path: Find the directory containing a =
file.<br>
find_path(&lt;VAR&gt; name1 [path1 path2 ...])<br>
This is the short-hand signature for the command that is sufficient in many=
 cases. It is the same as find_path(&lt;VAR&gt; name1 [PATHS path1 path2 ..=
.])<br>
<br>
find_path(<br>
&lt;VAR&gt;<br>
name | NAMES name1 [name2 ...]<br>
[HINTS path1 [path2 ... ENV var]]<br>
[PATHS path1 [path2 ... ENV var]]<br>
[PATH_SUFFIXES suffix1 [suffix2 ...]]<br>
[DOC &quot;cache documentation string&quot;]<br>
[NO_DEFAULT_PATH]<br>
[NO_CMAKE_ENVIRONMENT_PATH]<br>
[NO_CMAKE_PATH]<br>
[NO_SYSTEM_ENVIRONMENT_PATH]<br>
[NO_CMAKE_SYSTEM_PATH]<br>
[CMAKE_FIND_ROOT_PATH_BOTH |<br>
ONLY_CMAKE_FIND_ROOT_PATH |<br>
NO_CMAKE_FIND_ROOT_PATH]<br>
)<br>
This command is used to find a directory containing the named file. A cache=
 entry named by &lt;VAR&gt; is created to store the result of this command.=
 If the file in a directory is found the result is stored in the variable a=
nd the search will not be repeated unless the variable is cleared. If nothi=
ng is found, the result will be &lt;VAR&gt;-NOTFOUND, and the search will b=
e attempted again the next time find_path is invoked with the same variable=
. The name of the file in a directory that is searched for is specified by =
the names listed after the NAMES argument. Additional search locations can =
be specified after the PATHS argument. If ENV var is found in the HINTS or =
PATHS section the environment variable var will be read and converted from =
a system environment variable to a cmake style list of paths. For example E=
NV PATH would be a way to list the system path variable. The argument after=
 DOC will be used for the documentation string in the cache. PATH_SUFFIXES =
specifies additional subdirectories to check below each search path.<br>

<br>
If NO_DEFAULT_PATH is specified, then no additional paths are added to the =
search. If NO_DEFAULT_PATH is not specified, the search process is as follo=
ws:<br>
<br>
1. Search paths specified in cmake-specific cache variables. These are inte=
nded to be used on the command line with a -DVAR=3Dvalue. This can be skipp=
ed if NO_CMAKE_PATH is passed.<br>
<br>
&lt;prefix&gt;/include for each &lt;prefix&gt; in CMAKE_PREFIX_PATH<br>
CMAKE_INCLUDE_PATH<br>
CMAKE_FRAMEWORK_PATH<br>
2. Search paths specified in cmake-specific environment variables. These ar=
e intended to be set in the user&#39;s shell configuration. This can be ski=
pped if NO_CMAKE_ENVIRONMENT_PATH is passed.<br>
<br>
&lt;prefix&gt;/include for each &lt;prefix&gt; in CMAKE_PREFIX_PATH<br>
CMAKE_INCLUDE_PATH<br>
CMAKE_FRAMEWORK_PATH<br>
3. Search the paths specified by the HINTS option. These should be paths co=
mputed by system introspection, such as a hint provided by the location of =
another item already found. Hard-coded guesses should be specified with the=
 PATHS option.<br>

<br>
4. Search the standard system environment variables. This can be skipped if=
 NO_SYSTEM_ENVIRONMENT_PATH is an argument.<br>
<br>
PATH<br>
INCLUDE<br>
5. Search cmake variables defined in the Platform files for the current sys=
tem. This can be skipped if NO_CMAKE_SYSTEM_PATH is passed.<br>
<br>
&lt;prefix&gt;/include for each &lt;prefix&gt; in CMAKE_SYSTEM_PREFIX_PATH<=
br>
CMAKE_SYSTEM_INCLUDE_PATH<br>
CMAKE_SYSTEM_FRAMEWORK_PATH<br>
6. Search the paths specified by the PATHS option or in the short-hand vers=
ion of the command. These are typically hard-coded guesses.<br>
<br>
On Darwin or systems supporting OS X Frameworks, the cmake variable CMAKE_F=
IND_FRAMEWORK can be set to empty or one of the following:<br>
<br>
&quot;FIRST&quot; - Try to find frameworks before standard<br>
libraries or headers. This is the default on Darwin.<br>
&quot;LAST&quot; - Try to find frameworks after standard<br>
libraries or headers.<br>
&quot;ONLY&quot; - Only try to find frameworks.<br>
&quot;NEVER&quot;. - Never try to find frameworks.<br>
On Darwin or systems supporting OS X Application Bundles, the cmake variabl=
e CMAKE_FIND_APPBUNDLE can be set to empty or one of the following:<br>
<br>
&quot;FIRST&quot; - Try to find application bundles before standard<br>
programs. This is the default on Darwin.<br>
&quot;LAST&quot; - Try to find application bundles after standard<br>
programs.<br>
&quot;ONLY&quot; - Only try to find application bundles.<br>
&quot;NEVER&quot;. - Never try to find application bundles.<br>
The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more directories t=
o be prepended to all other search directories. This effectively &quot;re-r=
oots&quot; the entire search under given locations. By default it is empty.=
 It is especially useful when cross-compiling to point to the root director=
y of the target environment and CMake will search there too. By default at =
first the directories listed in CMAKE_FIND_ROOT_PATH and then the non-roote=
d directories will be searched. The default behavior can be adjusted by set=
ting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE. This behavior can be manually overr=
idden on a per-call basis. By using CMAKE_FIND_ROOT_PATH_BOTH the search or=
der will be as described above. If NO_CMAKE_FIND_ROOT_PATH is used then CMA=
KE_FIND_ROOT_PATH will not be used. If ONLY_CMAKE_FIND_ROOT_PATH is used th=
en only the re-rooted directories will be searched.<br>

<br>
The default search order is designed to be most-specific to least-specific =
for common use cases. Projects may override the order by simply calling the=
 command multiple times and using the NO_* options:<br>
<br>
find_path(&lt;VAR&gt; NAMES name PATHS paths... NO_DEFAULT_PATH)<br>
find_path(&lt;VAR&gt; NAMES name)<br>
Once one of the calls succeeds the result variable will be set and stored i=
n the cache so that no call will search again.<br>
<br>
When searching for frameworks, if the file is specified as A/b.h, then the =
framework search will look for A.framework/Headers/b.h. If that is found th=
e path will be set to the path to the framework. CMake will convert this to=
 the correct -F option to include the file.<br>

<br>
---<br>
Mike Jackson &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a hre=
f=3D"http://www.bluequartz.net" target=3D"_blank">www.bluequartz.net</a><di=
v><div></div><div class=3D"Wj3C7c"><br>
<br>
<br>
<br>
On Jan 13, 2009, at 5:08 PM, Robert Dailey wrote:<br>
<br>
</div></div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px sol=
id rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>=
<div></div><div class=3D"Wj3C7c">
Hi,<br>
<br>
I&#39;m currently looking at FindZLIB.cmake trying to understand how it wor=
ks and I just can&#39;t seem to make sense of it. I have a few questions:<b=
r>
 &nbsp; &nbsp; &nbsp; &nbsp;=95 How does find_path() know where to look? Wh=
ere is it looking? Where is it told where to look?<br>
 &nbsp; &nbsp; &nbsp; &nbsp;=95 Question #1 with find_library() as well.<br=
>
It would be great to be able to set a root directory with all my libraries =
in it and have it recursively go through it and find the file it is looking=
 for. This would be a convenient (but slow) way of getting find_path() and =
find_library() to work reliably in my case. Thanks in advance for any help.=
<br>
</div></div>
_______________________________________________<br>
CMake mailing list<br>
<a href=3D"mailto:CMake at cmake.org" target=3D"_blank">CMake at cmake.org</a><br=
>
<a href=3D"http://www.cmake.org/mailman/listinfo/cmake" target=3D"_blank">h=
ttp://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote>
<br>
_______________________________________________<br>
CMake mailing list<br>
<a href=3D"mailto:CMake at cmake.org" target=3D"_blank">CMake at cmake.org</a><br=
>
<a href=3D"http://www.cmake.org/mailman/listinfo/cmake" target=3D"_blank">h=
ttp://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>

------=_Part_95748_18917193.1231895173381--


More information about the CMake mailing list