From 9b82f8e598cf6cd2284debc0f23be5094b64534c Mon Sep 17 00:00:00 2001 From: Andrew Beggs Date: Thu, 26 Sep 2024 13:42:39 +0100 Subject: [PATCH] Add support NVTX3 for CMake versions >3.25 --- cmake/FindNVTX.cmake | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cmake/FindNVTX.cmake b/cmake/FindNVTX.cmake index 56ca746..c3d59b8 100644 --- a/cmake/FindNVTX.cmake +++ b/cmake/FindNVTX.cmake @@ -40,8 +40,25 @@ if(CMAKE_C_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "NVHPC" ) ) else() find_package(CUDAToolkit REQUIRED COMPONENTS CUDA::nvtx3) - set (NVTX_LIBRARY "CUDA::nvtx3") - #TODO: Implementation for NVTX3 + + find_path(NVTX_ROOT + NAMES include/nvtx3/nvToolsExt.h + HINTS ${CUDAToolkit_LIBRARY_DIR}/.. + ) + + find_path(NVTX_INCLUDE_DIRS + NAMES nvToolsExt.h + HINTS ${NVTX_ROOT}/include/nvtx3 + ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(NVTX DEFAULT_MSG + NVTX_INCLUDE_DIRS + ) + + mark_as_advanced( + NVTX_INCLUDE_DIRS + ) endif()