<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>I ask my self two questions:<br><br>1) Why is CUDA_NVCC_FLAGS not set to some default build setting that would just work out of the box? - I get the answer to this question when I turn on CUDA_VERBOSE_BUILD_MODE - It is being set under the hood.<br>


</blockquote><div><br>I guess I don&#39;t understand your question.  The CUDA_NVCC_FLAGS are the flags used by all targets all the time.  Occasionally additional flags are added (such as -fPIC on certain systems as well as other flags) that make it work based on your individual project configuration.  It does work out of the box for many applications.<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;">2) There is a CUDA_TOOLKIT_INCLUDE, but no CUDA_SDK_INCLUDE (or _LIB)... why? (this would prevent ${CUDA_SDK_ROOT_DIR}/common/inc - see below)<br>

<br></blockquote><div><br>As you found out the include directories for the
CUDA SDK are not supported by FindCUDA.  Those libraries and
headers are designed to be used by the SDK, and not particularly by
external packages.  That doesn&#39;t prevent you from doing so, but it was
decided that because the CUDA SDK won&#39;t maintain backward compatibility
and is only designed for the SDK that external use would not be
supported by FindCUDA.  As a compromise I chose to have as a bare minimum a path to the
SDK be supported for those who wished to poke in the SDK to find
things such as libraries or header files.  There is documentation in
the help files and in the FindCUDA.cmake file as well as examples of
what to do with the CUDA_SDK_ROOT_DIR variable.<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;">Maybe these guys could answer question 2:<br><br>James Bigler, NVIDIA Corp (<a href="http://nvidia.com" target="_blank">nvidia.com</a> - jbigler)<br>

</blockquote><div><br>This is me.  Abe has a job at Apple, and doesn&#39;t have much time to maintain this anymore.<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;">


Abe Stephens, SCI Institute -- <a href="http://www.sci.utah.edu/%7Eabe/FindCuda.html" target="_blank">http://www.sci.utah.edu/~abe/FindCuda.html</a><br><br><br>A request here would be to seperate FindCUDA into :<br><br>FindCUDA<br>

<br>and<br>
<br>FindNVIDIACUDASDK<br><br>and add include and lib dirs environment vars.<br></blockquote><div><br>I welcome any volunteers to maintain a FindCUDASDK.  I don&#39;t plan on ever supporting this.<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;">

<br>So I then add to my CMakeLists.txt file (I think in a vain attempt to make it work):<br><br>INCLUDE_DIRECTORIES( ${CUDA_SDK_ROOT_DIR}/common/inc )<br><br></blockquote><div><br>Yes, this in the right thing to do.<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;">So I add:<br><br>link_directories( ${CUDA_SDK_ROOT_DIR}/common/lib )<br><br></blockquote>

<div><br>You might want to do what I suggest in FindCUDA.cmake and do the following (copied from FindCUDA.cmake):<br><br># Example of how to find a library in the CUDA_SDK_ROOT_DIR<br><br># # cutil library is called cutil64 for 64 bit builds on windows.  We don&#39;t want<br>

# # to get these confused, so we are setting the name based on the word size of<br># # the build.<br><br># if(CMAKE_SIZEOF_VOID_P EQUAL 8)<br>#   set(cuda_cutil_name cutil64)<br># else(CMAKE_SIZEOF_VOID_P EQUAL 8)<br>#   set(cuda_cutil_name cutil32)<br>

# endif(CMAKE_SIZEOF_VOID_P EQUAL 8)<br><br># find_library(CUDA_CUT_LIBRARY<br>#   NAMES cutil ${cuda_cutil_name}<br>#   PATHS ${CUDA_SDK_SEARCH_PATH}<br>#   # The new version of the sdk shows up in common/lib, but the old one is in lib<br>

#   PATH_SUFFIXES &quot;common/lib&quot; &quot;lib&quot;<br>#   DOC &quot;Location of cutil library&quot;<br>#   NO_DEFAULT_PATH<br>#   )<br># # Now search system paths<br># find_library(CUDA_CUT_LIBRARY NAMES cutil ${cuda_cutil_name} DOC &quot;Location of cutil library&quot;)<br>

# mark_as_advanced(CUDA_CUT_LIBRARY)<br># set(CUDA_CUT_LIBRARIES ${CUDA_CUT_LIBRARY})<br><br>Then do things like target_link_libraries(nbody ${CUDA_CUT_LIBRARIES})<br><br>You shouldn&#39;t need to create imported libraries through add_library and set_properties.<br>

 <br></div>James<br></div>