1 diff --git a/cmake/Packages.cmake b/cmake/Packages.cmake
2 index 07c60eb..c736b3e 100644
3 --- a/cmake/Packages.cmake
4 +++ b/cmake/Packages.cmake
5 @@ -12,24 +12,29 @@ set_target_properties(${target} PROPERTIES
6 IMPORTED_LOCATION \"${target_path}\")")
8 configure_file(AMDDeviceLibsConfig.cmake.in
9 - ${PACKAGE_PREFIX}/AMDDeviceLibsConfig.cmake
10 + lib/cmake/AMDDeviceLibs/AMDDeviceLibsConfig.cmake
14 set(install_path_suffix "amdgcn/bitcode")
16 # Generate the install-tree package.
17 -# We do not know the absolute path to the intall tree until we are installed,
18 -# so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use
19 -# relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE.
20 -set(AMD_DEVICE_LIBS_PREFIX_CODE "
21 +if(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
22 + set(AMD_DEVICE_LIBS_PREFIX_CODE "set(AMD_DEVICE_LIBS_PREFIX \"${CMAKE_INSTALL_PREFIX}\")")
24 + # We do not know the absolute path to the install tree until we are installed,
25 + # so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use
26 + # relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE.
27 + set(AMD_DEVICE_LIBS_PREFIX_CODE "
28 # Derive absolute install prefix from config file path.
29 get_filename_component(AMD_DEVICE_LIBS_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
30 -string(REGEX REPLACE "/" ";" count "${PACKAGE_PREFIX}")
32 - set(AMD_DEVICE_LIBS_PREFIX_CODE "${AMD_DEVICE_LIBS_PREFIX_CODE}
33 + string(REGEX REPLACE "/" ";" count "${PACKAGE_PREFIX}")
35 + set(AMD_DEVICE_LIBS_PREFIX_CODE "${AMD_DEVICE_LIBS_PREFIX_CODE}
36 get_filename_component(AMD_DEVICE_LIBS_PREFIX \"\${AMD_DEVICE_LIBS_PREFIX}\" PATH)")
41 set(AMD_DEVICE_LIBS_TARGET_CODE)
42 foreach(target ${AMDGCN_LIB_LIST})
43 get_target_property(target_name ${target} ARCHIVE_OUTPUT_NAME)