On Thu, Jul 29, 2010 at 12:33 PM, Ryan Pavlik <span dir="ltr"><<a href="mailto:rpavlik@iastate.edu">rpavlik@iastate.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"> On 7/29/10 10:10 AM, lokmane.abbas-turki wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
<br>
I am a beginner on creating Visual projects with CMake for Cuda applications. I use the following CMakeLists<br>
<br>
cmake_minimum_required(VERSION 2.8)<br>
<br>
PROJECT(FermeHedge)<br>
<br>
#Searching CUDA<br>
FIND_PACKAGE(CUDA)<br>
</blockquote></div>
OK, this line is good, but...<div class="im"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
#Include the FindCUDA script<br>
INCLUDE(FindCUDA)<br>
</blockquote></div>
This line duplicates the previous line poorly - you can remove it.<div class="im"><br></div></blockquote><div><br>Correct. This is if you had a local FindCUDA.cmake script, and should be used alternatively to the find_package(CUDA) command not in addition to.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
SET(SOURCES<br>
<a href="http://aleat_lin.cu" target="_blank">aleat_lin.cu</a><br>
<a href="http://init.cu" target="_blank">init.cu</a><br>
<a href="http://io.cu" target="_blank">io.cu</a><br>
<a href="http://main.cu" target="_blank">main.cu</a><br>
<a href="http://tools.cu" target="_blank">tools.cu</a><br>
<a href="http://vars.cu" target="_blank">vars.cu</a><br>
aleat_lin.h<br>
init.h<br>
io.h<br>
timer.h<br>
tools.h<br>
types.h<br>
vars.h<br>
)<br>
<br>
ADD_EXECUTABLE(FermeHedge ${SOURCES})<br>
<br>
and I have the following generation errors<br>
<br>
Configuring done CMake Error: CMake can not determine linker language for target:FermeHedge<br>
CMake Error: CMake can not determine linker language for target:FermeHedge<br>
CMake Error: CMake can not determine linker language for target:FermeHedge<br>
Generating done<br>
I think that I should set up some paths manually, but I don't know which ones. Thanks for help<br>
<br>
</blockquote></div>
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.<br>
<br>
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.<br>
<br>
Ryan<font color="#888888"></font><br></blockquote></div><br>Correct. You have to use cuda_add_executable instead of add_executable. add_executable only knows about files that CMake is built to know about. cuda_add_executable knows how to deal with the CUDA files.<br>
<br>I would suggest reading the documentation as Ryan suggests, and afterward if you have further questions bring them up in the mailing list.<br><br>James<br>