LLNL/Caliper

Request to make exported paths relative to _IMPORT_PREFIX so Caliper installation is portable.

Closed this issue · 1 comments

One of the mission critical production codes at LLNL uses Caliper, and their process involves building Caliper on one file system then copying it to another file system.

The Caliper installation is not portable ( can not be moved ) due to some absolute paths in

share/cmake/caliper/caliper-config.cmake

Example:

 39   # Install layout                                                                                                                                                                                                                                   
 40   set(caliper_INSTALL_PREFIX /foo/bar/caliper-2.9.0-33w573iurxn6zhqrhnb6h756wse5nno3)                                                                                               
 41   set(caliper_INCLUDE_DIR    /foo/bar/caliper-2.9.0-33w573iurxn6zhqrhnb6h756wse5nno3/include)                                                                                       
 42   set(caliper_LIB_DIR        /foo/bar/caliper-2.9.0-33w573iurxn6zhqrhnb6h756wse5nno3/lib64)                                                                                         
 43   set(caliper_CMAKE_DIR      /foo/bar/caliper-2.9.0-33w573iurxn6zhqrhnb6h756wse5nno3/share/cmake/caliper)  

Please update these to be relative paths instead to _IMPORT_PREFIX, if possible

I poked around at what other libraries are doing to accompish this and saw that conduit, adiak, camp, umpire are doing things like:

 49 # Compute the installation prefix relative to this file.                                                                                                                                                                                             
 50 get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)                                                                                                                                                                             
 51 get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)                                                                                                                                                                                      
 52 get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)                                                                                                                                                                                      
 53 get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)                                                                                                                                                                                      
 54 if(_IMPORT_PREFIX STREQUAL "/")                                                                                                                                                                                                                      
 55   set(_IMPORT_PREFIX "")                                                                                                                                                                                                                             
 56 endif()     
set_target_properties(adiak::adiak PROPERTIES                                                                                                                                                                                                        
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"                                                                                                                                                                                          
  INTERFACE_LINK_LIBRARIES "adiak::mpi"                                                                                                                                                                                                              
)

Hi @aaroncblack, thanks for bringing this up. Shouldn't be a problem to change the exported paths, I'll look into it.