Skip to content

Commit

Permalink
Make sure include and lib dirs share parent directory
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA committed Aug 16, 2024
1 parent 7240793 commit 5e9aaba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rapids-cmake/cpm/nvcomp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ function(rapids_cpm_nvcomp)
# first configuration pass
if(NOT EXISTS "${nvcomp_ROOT}/${lib_dir}/cmake/nvcomp/nvcomp-targets-release.cmake")
include(GNUInstallDirs)
get_filename_component(lib_dir_parent "${lib_dir}" DIRECTORY)
get_filename_component(include_dir_parent "${CMAKE_INSTALL_INCLUDEDIR}" DIRECTORY)
if(NOT lib_dir_parent STREQUAL include_dir_parent)
message(FATAL_ERROR "CMAKE_INSTALL_INCLUDEDIR and CMAKE_INSTALL_LIBDIR must share parent directory"
)
endif()

get_filename_component(lib_dir_name "${lib_dir}" NAME)
file(READ "${nvcomp_ROOT}/lib/cmake/nvcomp/nvcomp-targets-release.cmake" FILE_CONTENTS)
string(REPLACE "\$\{_IMPORT_PREFIX\}/lib/" "\$\{_IMPORT_PREFIX\}/${lib_dir_name}/"
FILE_CONTENTS ${FILE_CONTENTS})
file(WRITE "${nvcomp_ROOT}/lib/cmake/nvcomp/nvcomp-targets-release.cmake" ${FILE_CONTENTS})
get_filename_component(lib_dir_parent "${lib_dir}" DIRECTORY)
file(MAKE_DIRECTORY "${nvcomp_ROOT}/${lib_dir_parent}")
file(RENAME "${nvcomp_ROOT}/lib/" "${nvcomp_ROOT}/${lib_dir}/")
get_filename_component(include_dir_parent "${CMAKE_INSTALL_INCLUDEDIR}" DIRECTORY)
file(MAKE_DIRECTORY "${nvcomp_ROOT}/${include_dir_parent}")
file(RENAME "${nvcomp_ROOT}/include/" "${nvcomp_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/")
endif()
Expand Down

0 comments on commit 5e9aaba

Please sign in to comment.