Say I have a project which contains four different directories :
1- Directory_1 : source_1.cpp , source_1.h ; CMakeLists.txt
2- Directory_2 : source_2.cpp , source_2.h ; CMakeLists.txt
3- Directory_3 : source_3.cpp , source_3.h ; CMakeLists.txt
4- Directory_4 : source_4.cu , CMakeLists.txt
When compiling the project using CMake , we will have the following directories in the build directory :
1- Directory_1 : we will get this compiled object : object_1
2- Directory_2 : we will get this compiled object : object_2
3- Directory_3 : we will get this compiled object : object_3
4- As for the directory 4 which contains .cu file , it needs some functions form the the three sources in the three different directories , so I must link the three objects ( object_1 , object_2 , object_3 ) to the sources_4 in the directory_4 cmakelists file .
Now every thing is fine with me , however I could not be able to link the three objects ( object_1 , object_2 , object_3 ) to the cuda file , here is my CmakeLists.txt file in the Directory_4 :
cuda_add_executable( cuda_object financial.cu )
target_link_libraries( cuda_object object_1 object_2 object_3)
I really appreciate any help .