| 1 |
cmake_policy(SET CMP0104 NEW) |
| 2 |
enable_language(CUDA) |
| 3 |
file(TOUCH ${CMAKE_BINARY_DIR}/empty.cmake) |
| 4 |
|
| 5 |
add_library(simplecudaobj OBJECT simplelib.cu) |
| 6 |
set_target_properties(simplecudaobj |
| 7 |
PROPERTIES |
| 8 |
POSITION_INDEPENDENT_CODE ON) |
| 9 |
|
| 10 |
add_library(simplecudashared SHARED ) |
| 11 |
target_link_libraries(simplecudashared PRIVATE simplecudaobj) |
| 12 |
set_target_properties(simplecudaobj simplecudashared |
| 13 |
PROPERTIES |
| 14 |
CUDA_SEPARABLE_COMPILATION ON) |
| 15 |
|
| 16 |
add_executable(simplecudaexe main.cu ) |
| 17 |
target_link_libraries(simplecudaexe PRIVATE simplecudashared) |
| 18 |
|
| 19 |
if(WIN32 AND CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") |
| 20 |
set(generate_output_files_NO_EXE_LIB 1) |
| 21 |
endif() |
| 22 |
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) |
| 23 |
generate_output_files(simplecudaexe simplecudashared simplecudaobj) |
| 24 |
|
| 25 |
file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(GENERATED_FILES [==[${CMAKE_BINARY_DIR}/empty.cmake]==])\n") |