[CMake] Cuda with CMake

Ryan Pavlik rpavlik at iastate.edu
Thu Jul 29 14:33:55 EDT 2010


  On 7/29/10 10:10 AM, lokmane.abbas-turki wrote:
>
>
> I am a beginner on creating Visual projects with CMake for Cuda applications. I use the following CMakeLists
>
> cmake_minimum_required(VERSION 2.8)
>
> PROJECT(FermeHedge)
>
> #Searching CUDA
> FIND_PACKAGE(CUDA)
OK, this line is good, but...
> #Include the FindCUDA script
> INCLUDE(FindCUDA)
This line duplicates the previous line poorly - you can remove it.
> SET(SOURCES
>          aleat_lin.cu
>          init.cu
>          io.cu
>          main.cu
>          tools.cu
>          vars.cu
>          aleat_lin.h
>          init.h
>          io.h
>          timer.h
>          tools.h
>          types.h
>          vars.h
> )
>
>                 
>     
> ADD_EXECUTABLE(FermeHedge ${SOURCES})
>
> and I have the following generation errors
>
> Configuring done CMake Error: CMake can not determine linker language for target:FermeHedge
> CMake Error: CMake can not determine linker language for target:FermeHedge
> CMake Error: CMake can not determine linker language for target:FermeHedge
> Generating done
>   
> I think that I should set up some paths manually, but I don't know which ones. Thanks for help
>
It doesn't look like you have a .c or .cpp main application - header 
files are added to project files but generally not compiled on their 
own. Thus, CMake doesn't know how to link any object files produced.

If you want to create a CUDA executable, it looks like the 
find_package(CUDA) command defines some functions, including 
cuda_add_executable which is possibly what you want.  See the top of the 
FindCUDA.cmake file or the web docs under "Standard CMake Modules" for 
more info.

Ryan

-- 
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com/



More information about the CMake mailing list