Skip to content

Commit

Permalink
Explicitly create namespaced ALIAS targets for RDC libraries
Browse files Browse the repository at this point in the history
If explicit ALIAS targets with the final install namespace (e.g.
"NS::Target" for "Target") are not created for an RDC library,
the installed targets have the wrong names set for the CUDA_RDC
properties. This results in both compile and (unseen) link errors
because the bare target names are interpreted as raw libraries,
not CMake targets. Dependencies are then not transmitted correctly,
resulting in compile/link issues for missing include paths etc.

Explicitly create ALIAS targets for CopCore and AdePT RDC libraries
to ensure they are installed with the correct install-time target
names for their `CUDA_RDC_...` properties.
  • Loading branch information
drbenmorgan committed Jun 11, 2024
1 parent 0d065c7 commit a496629
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ set(ADEPT_G4_INTEGRATION_SRCS
)

cuda_rdc_add_library(CopCore INTERFACE)
cuda_rdc_add_library(CopCore::CopCore ALIAS CopCore)
cuda_rdc_target_include_directories(CopCore
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/AdePT/copcore/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
)

cuda_rdc_add_library(AdePT_G4_integration SHARED ${ADEPT_G4_INTEGRATION_SRCS})
cuda_rdc_add_library(AdePT::AdePT_G4_integration ALIAS AdePT_G4_integration)
cuda_rdc_target_include_directories(AdePT_G4_integration
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down

0 comments on commit a496629

Please sign in to comment.