[CMake] cudalib linker error

Bastian Moldenhauer bastianmoldenhauer at web.de
Thu Feb 10 10:03:48 EST 2011


Hi,

 

i have some problems to get my project correctly linked and running.

Those are the files and content involved.

 

//app.cpp

#include "lib.h"

void main()

{

start();

}

 

//lib.h

void start();

 

//lib.cpp

#include "lib.h"

#include "cudalib.h"

void start()

{

startCudaKernel ();

}

 

//cudalib.h

void startCudaKernel();

 

//cudalib.cu

extern "C"

void startCudaKernel()

{

//start a cuda kernel etc.

}

 

//cmakelists.txt

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(CuCo)

 

FIND_PACKAGE(Cuda REQUIRED)

 

FILE(GLOB cudasrc "cudalib.cu" "cudalib.h")

CUDA_ADD_LIBRARY(cudalib ${cudasrc})

 

FILE(GLOB libsrc "lib.cpp" "lib.h")

ADD_LIBRARY(liby ${libsrc})

TARGET_LINK_LIBRARIES(liby cudalib)

 

FILE(GLOB appsrc "app.cpp")

ADD_EXECUTABLE(app ${appsrc})

TARGET_LINK_LIBRARIES(app liby)

 

And i am using vs2010 and i know that i have to change the toolset to
vc90(any idea to let cmake set this btw?)

 

I always get an linker error telling me that "startCudaKernel" is not
resolved. I have no idea why this error occures. Everything builds fine,
even nvcc tells me that everything is correct. Only the linker has a problem
to link everything.

 

Regards and Thanks for your help.

Basti 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110210/4d6e6861/attachment-0001.htm>


More information about the CMake mailing list