FindCUDA.cmake failing Updates/Patches to

Trying to use FindCUDA.cmake out of the box, but get numerous compiling errors running cmake. Is there some additional step necessary beyond just checking it out from the repository?

someone@phenom:~/projects$ cmake --version
cmake version 2.6-patch 0
someone@phenom:~/projects$ svn co https://gforge.sci.utah.edu/svn/findcuda/trunk CMake-cuda
A CMake-cuda/CMake
A CMake-cuda/CMake/cuda
A CMake-cuda/CMake/cuda/make2cmake.cmake
A CMake-cuda/CMake/cuda/parse_cubin.cmake
A CMake-cuda/CMake/cuda/FindCUDA.cmake
A CMake-cuda/CMake/cuda/run_nvcc.cmake
A CMake-cuda/FindCuda.html
A CMake-cuda/LICENSE.txt
A CMake-cuda/src
A CMake-cuda/src/main_for_lib.cc
A CMake-cuda/src/external_dependency.h
A CMake-cuda/src/main.cc
A CMake-cuda/src/external_dependency3.h
A CMake-cuda/src/test_lib.cu
A CMake-cuda/src/CMakeLists.txt
A CMake-cuda/src/test_bin.cu
A CMake-cuda/CMakeLists.txt
Checked out revision 1152.
someone@phenom:~/projects$ cd CMake-cuda/
someone@phenom:~/projects/CMake-cuda$ cmake .
– The C compiler identification is GNU
– The CXX compiler identification is GNU
– Check for working C compiler: /usr/bin/gcc
– Check for working C compiler: /usr/bin/gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
CMake Error at CMake/cuda/FindCUDA.cmake:412 (if):
if had incorrect arguments: CUDA_FIND_VERSION_EXACT AND NOT CUDA_VERSION
VERSION_EQUAL CUDA_FIND_VERSION (Unknown arguments specified).
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)

CMake Error at CMake/cuda/FindCUDA.cmake:414 (endif):
endif An ENDIF command was found outside of a proper IF ENDIF structure.
Or its arguments did not match the opening IF command.
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)

CMake Error at CMake/cuda/FindCUDA.cmake:416 (if):
if had incorrect arguments: CUDA_FIND_VERSION AND CUDA_VERSION VERSION_LESS
CUDA_FIND_VERSION (Unknown arguments specified).
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)

CMake Error at CMake/cuda/FindCUDA.cmake:418 (endif):
endif An ENDIF command was found outside of a proper IF ENDIF structure.
Or its arguments did not match the opening IF command.
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)

CMake Error at CMake/cuda/FindCUDA.cmake:423 (message):
Requested CUDA version , but found unacceptable version 2.2
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)

– Configuring done
someone@phenom:~/projects/CMake-cuda$

This error is due to using a version of CMake < 2.6.2. Please upgrade your version of CMake (http://www.cmake.org). The latest version is 2.6.4.

I’m not sure I can put a check in the FindCUDA.cmake script itself, but I can at least put one in the top level CMakeLists.txt.

I just updated the scripts to enforce this. Please update and try again.

was running Ubuntu 8.10(Intrepid Ibex) which provides cmake 2.6.0 upgrading to Ubuntu 9.04(Jaunty Jackalope) brought cmake up to 2.6.2 and

that fixes the issue. Thank you.

As long as you have this on the table…

When creating project files I find I have to add this everytime:

FIND_PACKAGE(CUDA)

INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})

CUDA_ADD_EXECUTABLE(cudajpeg

non_dit_fdct.cu

dct.cpp

utils.cpp

basicdctmain.cpp

)

Would it make sense to have CUDA_ADD_EXECUTABLE or FindCUDA.cmake do the INCLUDE_DIRECTORIES operation when creating the executable?

One of the concerns I had was that I wanted the user to know that this include path would be applicable for the entire directory (include paths are scoped by directory), though that shouldn’t really matter for non CUDA applications. I wish I could add it to just a target, but CMake doesn’t support that.

I guess the principal of least surprise would mean it would be helpful to add this in the CUDA_ADD_LIBRARY and CUDA_ADD_EXECUTABLE macros. I don’t think it would be appropriate to add it automatically for CUDA_COMPILE and CUDA_COMPILE_PTX since those just translate cuda files and don’t compile non device files.

This should be checked into r1167.