Skip to content

Commit

Permalink
Add option for installation
Browse files Browse the repository at this point in the history
  • Loading branch information
chillenzer committed Feb 7, 2025
1 parent 09924e2 commit 6b66f97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ endif()
################################################################################
# Installation.

option(alpaka_INSTALL "" OFF)
# Do not install if alpaka is used as a CMake subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR alpaka_INSTALL)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)

Expand Down Expand Up @@ -204,4 +205,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
DESTINATION "${_alpaka_INSTALL_CMAKEDIR}")
install(DIRECTORY "${_alpaka_ROOT_DIR}/cmake/tests"
DESTINATION "${_alpaka_INSTALL_CMAKEDIR}")

install(TARGETS alpaka EXPORT alpakaTargets)
install(EXPORT alpakaTargets DESTINATION "${_alpaka_INSTALL_CMAKEDIR}" NAMESPACE alpaka::)
endif()
12 changes: 9 additions & 3 deletions cmake/alpakaCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ if(alpaka_ACC_GPU_HIP_ENABLE)

set(_alpaka_HIP_MIN_VER 5.1)
set(_alpaka_HIP_MAX_VER 6.2)

checkCompilerCXXSupport(HIP ${alpaka_MIN_CXX_STANDARD})

# construct hip version only with major and minor level
Expand Down Expand Up @@ -873,9 +873,15 @@ if(TARGET alpaka)
# the alpaka library itself
# SYSTEM voids showing warnings produced by alpaka when used in user applications.
if(BUILD_TESTING)
target_include_directories(alpaka INTERFACE ${_alpaka_INCLUDE_DIRECTORY})
target_include_directories(alpaka
INTERFACE
$<BUILD_INTERFACE:${_alpaka_INCLUDE_DIRECTORY}>
$<INSTALL_INTERFACE:include>)
else()
target_include_directories(alpaka SYSTEM INTERFACE ${_alpaka_INCLUDE_DIRECTORY})
target_include_directories(alpaka
SYSTEM INTERFACE
$<BUILD_INTERFACE:${_alpaka_INCLUDE_DIRECTORY}>
$<INSTALL_INTERFACE:include>)
endif()

if(${alpaka_DEBUG} GREATER 1)
Expand Down

0 comments on commit 6b66f97

Please sign in to comment.