diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index ab52b766e2..5bfde685ab 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -330,36 +330,45 @@ include(CPack) install(TARGETS raft DESTINATION ${lib_dir} + COMPONENT raft EXPORT raft-exports) install(TARGETS raft_distance DESTINATION ${lib_dir} + COMPONENT raft_distance EXPORT raft-distance-exports) + install(TARGETS raft_nn DESTINATION ${lib_dir} + COMPONENT raft_nn EXPORT raft-nn-exports) if(TARGET raft_distance_lib) install(TARGETS raft_distance_lib DESTINATION ${lib_dir} + COMPONENT raft_distance EXPORT raft-distance-lib-exports) endif() if(TARGET raft_nn_lib) install(TARGETS raft_nn_lib DESTINATION ${lib_dir} + COMPONENT raft_nn EXPORT raft-nn-lib-exports) endif() install(DIRECTORY include/raft + COMPONENT raft DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # Temporary install of raft.hpp while the file is removed install(FILES include/raft.hpp + COMPONENT raft DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/raft) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/raft/version_config.hpp + COMPONENT raft DESTINATION include/raft) ############################################################################## @@ -443,11 +452,18 @@ if(TARGET raft_nn_lib) endif() foreach(comp IN LISTS raft_components) + if(${comp} MATCHES ".*()-lib") + set(install_comp ${CMAKE_MATCH_1}) + else() + set(install_comp ${comp}) + endif() + install( EXPORT raft-${comp}-exports FILE raft-${comp}-targets.cmake NAMESPACE raft:: DESTINATION "${lib_dir}/cmake/raft" + COMPONENT raft_${install_comp} ) export( EXPORT raft-${comp}-exports @@ -458,7 +474,7 @@ foreach(comp IN LISTS raft_components) BUILD raft-${comp}-exports "${PROJECT_BINARY_DIR}/raft-${comp}-dependencies.cmake" ) rapids_export_write_dependencies( - INSTALL raft-${comp}-exports "${PROJECT_BINARY_DIR}/rapids-cmake/raft/export/raft-${comp}-dependencies.cmake" + INSTALL raft-${comp}-exports "${PROJECT_BINARY_DIR}/rapids-cmake/raft/export/raft-${install_comp}/raft-${comp}-dependencies.cmake" ) endforeach() diff --git a/cpp/cmake/modules/raft_export.cmake b/cpp/cmake/modules/raft_export.cmake index e89a9c5ee6..341a839986 100644 --- a/cpp/cmake/modules/raft_export.cmake +++ b/cpp/cmake/modules/raft_export.cmake @@ -185,7 +185,8 @@ function(raft_export type project_name) endif() install(EXPORT ${RAPIDS_EXPORT_SET} FILE ${project_name}-targets.cmake - NAMESPACE ${RAPIDS_PROJECT_VERSION} DESTINATION "${install_location}") + NAMESPACE ${RAPIDS_PROJECT_VERSION} DESTINATION "${install_location}" + COMPONENT raft) if(TARGET rapids_export_install_${RAPIDS_EXPORT_SET}) include("${rapids-cmake-dir}/export/write_dependencies.cmake") @@ -202,7 +203,10 @@ function(raft_export type project_name) endif() # Install everything we have generated - install(DIRECTORY "${scratch_dir}/" DESTINATION "${install_location}") + foreach(comp raft_nn raft_distance) + install(DIRECTORY "${scratch_dir}/${comp}" DESTINATION "${install_location}" + COMPONENT ${comp}) + endforeach() else() set(install_location "${PROJECT_BINARY_DIR}") @@ -235,4 +239,4 @@ function(raft_export type project_name) endif() -endfunction() \ No newline at end of file +endfunction()