| 1 |
cmake_minimum_required(VERSION 3.18) |
| 2 |
project (ObjectLibrary CUDA CXX) |
| 3 |
#Goal for this example: |
| 4 |
# |
| 5 |
#Build C++ and CUDA object files and than use them to make an executable |
| 6 |
#Make sure that CMake logic to handle object output when multiple files |
| 7 |
#with the same name works |
| 8 |
add_subdirectory(Conflicts) |
| 9 |
|
| 10 |
add_library(CudaMixedObjectLib OBJECT static.cu static.cpp) |
| 11 |
|
| 12 |
add_executable(CudaObjectLibrary |
| 13 |
main.cpp |
| 14 |
$<TARGET_OBJECTS:CudaMixedObjectLib> |
| 15 |
$<TARGET_OBJECTS:CudaConflicts>) |
| 16 |
|
| 17 |
if(APPLE) |
| 18 |
# Help the static cuda runtime find the driver (libcuda.dyllib) at runtime. |
| 19 |
set_property(TARGET CudaObjectLibrary PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) |
| 20 |
endif() |