FindCUDA.cmake has moved
automatically redirecting to new web page.
For more information about
CMake and Cuda:
SVN revision r813 contains
major changes to FindCUDA.cmake. Please see details below. To use the
old script, check out a prior revision from the svn server.
NOTE: The source code is hosted at a new svn server: https://code.sci.utah.edu/svn/findcuda/trunk
This web page contains information about an unofficial version
FindCuda.cmake script I developed for my own CUDA programs. Many individuals have adopted the
script and suggested improvements, and tested the script on various
platforms and configurations. I appreciate all of the feedback and bug
fixes I have received since the initial release.
This webpage is updated infrequently- the svn log contains details
about bug fixes and updates.
Please send any comments or questions to my email. If you use the
NVIDIA forums, I might not see you question for some time.
Scientific Computing and Imaging Institute, University of Utah.
- Works on all CUDA platforms, tested with CUDA 2.1 beta. Will
generate visual studio project files.
- Parses an nvcc generated dependency file into CMake format.
Targets will be regenerated when dependencies change.
- Displays kernel register usage during compilation.
- Support for compilation to executable, shared libary, or PTX.
We released a major revision to the script in December 2008 at
approximately the same time as the CUDA 2.1 beta. There are many
differences in the new version of the script and it has been tested
extensively on Linux, Mac, and WinXP/Vista.
It is necessary to make several
changes to a project's CMakeLists.txt files in order to use the new
List of partial changes:
Major bug fixes:
- The capitalization of the script's filename is changed to
- The script may be included using FIND_PACKAGE (see example code).
- Switched to standard CMake package variable names: (e.g. CUDA_INCLUDE_DIRS instead of
instead of CUDA_TARGET_LINK).
- Selection of Device or Release mode via boolean option CUDA_BUILD_EMULATION instead
of a text string.
- Paths added to INCLUDE_DIRECTORIES are passed to nvcc.
- Added option to host compilation mode boolean option.
- Added CUDA_COMPILE_PTX macro for compilation to .ptx.
- Added a macro generated target to clean all generated
- Locates the cuFFT and cuBLAS libraries as well (both in Device
and Emulation mode).
- Fixed problem in Emulation mode which caused targets to
continuously be rebuilt.
- Fixed problems associated with incomplete compilation in visual
- Updated default paths for toolkit and SDK on several platforms.
- Set the cmake cache variable CUDA_BUILD_CUBIN
to enable or disable generation and parsing of .cubin files for kernels
in Device mode. When enabled the number of registers, memory usage,
etc. will be printed to the console for each kernel. This information
can be entered in the Cuda
- The script will output the actual command lines used in verbose
mode (e.g. make VERBOSE=1).
- The example code is intended to demonstrate cmake script usage
only, the .cu files don't do anything illustrative.
The code is available in an svn repository:
Either checkout the example project:
The script will search for your cuda toolkit and SDK installation using
several standard paths and the
environment variables which are created by the installer.
The following example includes the script and shows how to add code in
an executable. The CUDA_ADD_* commands have the same
semantics as the standard ADD_* commands.
See additional usage in the example project.
For more information,
please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2007-2008
Scientific Computing and Imaging Institute, University of Utah
License for the specific language governing rights and
Permission is hereby granted, free of charge, to any person
copy of this software and associated documentation files (the
to deal in the Software without restriction, including without
the rights to use, copy, modify, merge, publish, distribute,
and/or sell copies of the Software, and to permit persons to
Software is furnished to do so, subject to the following
The above copyright notice and this permission notice shall be
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
DEALINGS IN THE SOFTWARE.