On Thu, Jan 7, 2010 at 5:08 PM, Brian Davis <span dir="ltr">&lt;<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br><div class="gmail_quote"><div><br> </div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div>
</div>
<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div>From FindCuda (with cmake now in my build tree so I can patch it):<br>

<br>  # Search in the CUDA_BIN_PATH first.<br>  find_path(CUDA_TOOLKIT_ROOT_DIR<br>    NAMES nvcc nvcc.exe<br>    PATHS ENV CUDA_BIN_PATH<br>    DOC &quot;Toolkit location.&quot;<br>
    NO_DEFAULT_PATH<br>    )<br>  # Now search default paths<br>  find_path(CUDA_TOOLKIT_ROOT_DIR<br>    NAMES nvcc nvcc.exe<br>    PATHS /usr/local/bin<br>          /usr/local/cuda/bin<br>    DOC &quot;Toolkit location.&quot;<br>





    )<br><br></div></div></blockquote></div><div><br>I think the reason that the find_path(CUDA_TOOLKIT_ROOT_DIR doesn&#39;t
work with the paths supplied by find_package is that your paths don&#39;t
include the bin directory, and thus misses the executable.  I&#39;ll have
to look into that more, but for now you should just specify the
locations with CUDA_TOOLKIT_ROOT_DIR (as per the documentation in
FindCUDA.cmake).<br>
<br></div></div></blockquote></div><div><br>I gave this a try:<br><br>#    set( CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_DIR} CACHE STRING &quot;&quot; FORCE )<div class="im"><br>#    set( CUDA_SDK_ROOT_DIR ${NVIDIA_SDK_DIR} CACHE STRING &quot;&quot; FORCE )<br>


    <br>    find_package( cuda PATHS ${CUDA_TOOLKIT_DIR} ${NVIDIA_SDK_DIR} <br></div>        C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/bin<br>        C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2/bin<br>


        NO_DEFAULT_PATH)<br><br>and it did not work.  I can get it to work by commenting out the set&#39;s above.<br><br></div></div></blockquote><div><br>Sure that didn&#39;t work, because the find_path command was looking for nvcc in ${CUDA_TOOLKIT_DIR} instead of looking for bin/nvcc in ${CUDA_TOOLKIT_DIR}.  I suspect if you changed find_package to use ${CUDA_TOOLKIT_DIR/bin it might work, though for 64 bit builds it would have to be ${CUDA_TOOLKIT_DIR}/bin64.  I&#39;ll see if I can experiment with this a bit more and figure out what is the right solution to make both of these scenarios work.<br>

 <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div> </div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div class="gmail_quote"><div> 
<br></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div>Following the advice from <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html" target="_blank">http://www.cmake.org/cmake/help/cmake-2-8-docs.html</a>:<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_package(&lt;package&gt; PATHS paths... NO_DEFAULT_PATH)<br>   find_package(&lt;package&gt;)<br><br>This is urrr... umm... hokey (calling multiple times).  And I cannot seem to get it to work.<br></div></div></blockquote>




</div><div><br>I use this construct, because CMake will favor default paths before supplied paths, and I want to make sure that the stuff in my path is found first.<br> <br></div></div></blockquote></div><div><br>This is an general internal CMake construct which is not FindCUDA specific yes/no?<br>

</div></div></blockquote></div><br>Yes, this is how CMake works.  The documentation for the find_XYZ functions explains the search order, and subsequent emails to mailing list helped me settle determine that this construct is the only way to obtain the needed functionality.  Perhaps CMake could be augmented with a &quot;USE_SUPPLIED_PATHS_FIRST&quot; argument to change the search ordering to help avoid having to run the command twice.<br>

<br>James <br>