CMakeLists.txt 600 B

1234567891011121314151617
  1. cmake_minimum_required(VERSION 3.7)
  2. project (CudaObjectLibrary CUDA CXX)
  3. #Goal for this example:
  4. #build a object files some with cuda and some without than
  5. #embed these into an executable
  6. add_library(CudaMixedObjectLib OBJECT static.cu static.cpp)
  7. add_executable(CudaObjectLibrary
  8. main.cpp
  9. $<TARGET_OBJECTS:CudaMixedObjectLib>)
  10. if(APPLE)
  11. # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
  12. # the static cuda runtime can find it at runtime.
  13. target_link_libraries(CudaObjectLibrary PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
  14. endif()