From b2718a9232b6de51f4beffcaa8ba1bfccc6b82e7 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Mon, 6 Nov 2023 13:13:21 -0500 Subject: [PATCH] examples,hip: use find_package(hip) once in proj --- examples/hello/CMakeLists.txt | 3 +-- examples/hello/bpWriteReadHip/CMakeLists.txt | 22 ++++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/examples/hello/CMakeLists.txt b/examples/hello/CMakeLists.txt index 297ed51882..0c1344503a 100644 --- a/examples/hello/CMakeLists.txt +++ b/examples/hello/CMakeLists.txt @@ -19,8 +19,7 @@ if(ADIOS2_HAVE_CUDA OR ADIOS2_HAVE_Kokkos_CUDA) add_subdirectory(bpWriteReadCuda) endif() -find_package(hip QUIET) -if(ADIOS2_HAVE_Kokkos_HIP OR hip_FOUND) +if(ADIOS2_HAVE_Kokkos_HIP) add_subdirectory(bpWriteReadHip) endif() diff --git a/examples/hello/bpWriteReadHip/CMakeLists.txt b/examples/hello/bpWriteReadHip/CMakeLists.txt index bb1b6d3acf..990981b5a6 100644 --- a/examples/hello/bpWriteReadHip/CMakeLists.txt +++ b/examples/hello/bpWriteReadHip/CMakeLists.txt @@ -7,19 +7,15 @@ cmake_minimum_required(VERSION 3.12) project(ADIOS2HelloBPWriteReadHipExample) if(NOT TARGET adios2_core) - set(_components CXX) + find_package(ADIOS2 REQUIRED COMPONENTS CXX) +endif() - find_package(hip QUIET) - if(hip_FOUND) - enable_language(HIP) - endif() +enable_language(HIP) - find_package(ADIOS2 REQUIRED COMPONENTS ${_components}) -endif() +# Needed for the hip cmake targets +find_package(hip REQUIRED) -if(ADIOS2_HAVE_Kokkos_HIP OR hip_FOUND) - add_executable(adios2_hello_bpWriteReadHip bpWriteReadHip.cpp) - target_link_libraries(adios2_hello_bpWriteReadHip adios2::cxx11 hip::device) - set_source_files_properties(bpWriteReadHip.cpp PROPERTIES LANGUAGE HIP) - install(TARGETS adios2_hello_bpWriteReadHip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif() +add_executable(adios2_hello_bpWriteReadHip bpWriteReadHip.cpp) +target_link_libraries(adios2_hello_bpWriteReadHip adios2::cxx11 hip::device) +set_source_files_properties(bpWriteReadHip.cpp PROPERTIES LANGUAGE HIP) +install(TARGETS adios2_hello_bpWriteReadHip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})