<div dir="ltr">Hi Folks, <div><br></div><div style>It turns out the &quot;export(PACKAGE ..)&quot; does NOT have issue, the problem was that the value I associated with &lt;PROJECT_NAME&gt;_DIR was incorrect and since a &lt;PROJECT_NAME&gt; package had been exported earlier, CMake found one despite the fact an error would have been expected.</div>

<div style><br></div><div style>I guess it would make sens to add an option CMAKE_FIND_PACKAGE_NO_DEFAULT_PATH. Such option would help ensuring no default path are used where they are not expected.</div><div style><br></div>

<div style>If needed, we could also add option like:<br></div><div style><div><br></div><div>                CMAKE_FIND_PACKAGE_NO_CMAKE_ENVIRONMENT_PATH</div><div>                CMAKE_FIND_PACKAGE_NO_CMAKE_PATH</div><div>

                CMAKE_FIND_PACKAGE_NO_SYSTEM_ENVIRONMENT_PATH</div><div>                CMAKE_FIND_PACKAGE_NO_CMAKE_PACKAGE_REGISTRY</div><div>                CMAKE_FIND_PACKAGE_NO_CMAKE_BUILDS_PATH</div><div>                CMAKE_FIND_PACKAGE_NO_CMAKE_SYSTEM_PATH</div>

<div>                CMAKE_FIND_PACKAGE_NO_CMAKE_SYSTEM_PACKAGE_REGISTRY</div><div><br></div><div style>To provide full background, the value associated with &lt;PROJECT_NAME&gt;_DIR was: </div><div style><br></div><div style>

    /path/to/project-install/lib/projname/cmake</div><div style><br></div><div style>on both UNIX and WIN32. The problem was that on WIN32, the following value was expected:<br></div><div style><br></div><div style>   /path/to/project-install/cmake</div>

<div><br></div><div style>Thanks</div><div style>Jc</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 28, 2013 at 5:18 PM, David Cole <span dir="ltr">&lt;<a href="mailto:dlrdave@aol.com" target="_blank">dlrdave@aol.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If &lt;PROJECT_NAME&gt;_DIR is given and has a correct value, it is a bug if find_package finds the project anywhere else. Whether that&#39;s generally true or not, I sort of doubt it. It probably depends on the project itself, and the find and/or config files involved.<br>


<br>
I second Stephen&#39;s request for steps to reproduce.<br>
<br>
If it&#39;s true, it&#39;s a bug that should be fixed, not something where we should deprecate export(PACKAGE or add warnings...<br>
<br>
<br>
Just my opinion,<br>
David C.<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: Stephen Kelly &lt;<a href="mailto:steveire@gmail.com" target="_blank">steveire@gmail.com</a>&gt;<br>
To: cmake &lt;<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>&gt;<br>
Sent: Thu, Mar 28, 2013 5:12 pm<br>
Subject: Re: [CMake] Usage of export(PACKAGE ...)<br>
<br>
<br>
Jean-Christophe Fillion-Robin wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Folks,<br>
<br>
I would like to discussed the usable of &quot;export(PACKAGE ...)&quot; <br>
</blockquote>
statement.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Based on my experience, it turns out that exporting the build tree in <br>
</blockquote>
the<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
system package registry is a bad idea when building the same package<br>
multiple time as it is done on a dashboard client or a developer<br>
workstation trying out multiple configurations. Indeed, when<br>
&quot;find_package&quot; is used in &quot;CONFIG&quot; (or &quot;NO_MODULE&quot;) mode, by default <br>
</blockquote>
CMake<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
will search into the CMAKE_SYSTEM_PACKAGE_REGISTRY and will resolve <br>
</blockquote>
to an<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
already generated build tree instead of the one passed using<br>
&lt;PROJECT_NAME&gt;_DIR.<br>
<br>
What do you think ? Should we deprecate the use of &quot;export(PACKAGE <br>
</blockquote>
..)&quot; or<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
add a warning in the documentation ?<br>
<br>
Reference:<br>
<a href="http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command:export" target="_blank">http://www.cmake.org/cmake/<u></u>help/v2.8.10/cmake.html#<u></u>command:export</a><br>
<br>
</blockquote>
<br>
I filed <a href="http://public.kitware.com/Bug/view.php?id=13747" target="_blank">http://public.kitware.com/Bug/<u></u>view.php?id=13747</a> about this some time<br>
ago, but I haven&#39;t tried to reproduce it since, and I don&#39;t have a testplan<br>
for it. Could you describe a reliable way to reproduce the problem?<br>
<br>
Thanks,<br>
<br>
Steve.<br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
<br>
 --<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>+1 919 869 8849<br>
</div>