@@ -23,9 +23,19 @@ endif()
2323set  ( CMAKE_INSTALL_RPATH  ${CMAKE_INSTALL_PREFIX} /${LIB_DIR} ;${CMAKE_INSTALL_PREFIX} /${PLUGINS_DIR} ;${CMAKE_INSTALL_PREFIX} /${PVPLUGINS_DIR}  )
2424
2525########################################################################### 
26- # LD_PRELOAD libraries  
26+ # LD_PRELOAD TCMalloc  
2727########################################################################### 
28- set  ( EXTRA_LDPRELOAD_LIBS "${TCMALLOC_LIBRARIES} "  )
28+ # User systems will only have the libraries and not the symbolic link 
29+ # so we must set the preload to the versioned library. We will assume it is 
30+ # in the same location as the system that the package was built on 
31+ if  ( TCMALLOC_LIBRARIES )
32+   execute_process  ( COMMAND  readlink --no -newline --canonicalize-existing ${TCMALLOC_LIBRARIES} 
33+                     OUTPUT_VARIABLE  TCMALLOC_PRELOAD
34+                     RESULT_VARIABLE  READLINK_RESULT )
35+   if  ( READLINK_RESULT EQUAL  1 )
36+     message  ( FATAL_ERROR "Unable to find real file that tcmalloc symlink, ${TCMALLOC_LIBRARIES} , points to."  )
37+   endif ()
38+ endif ()
2939
3040########################################################################### 
3141# Environment scripts (profile.d) 
@@ -84,10 +94,12 @@ set ( POST_UNINSTALL_FILE ${CMAKE_CURRENT_BINARY_DIR}/postrm )
8494
8595if  ( "${UNIX_DIST} "  MATCHES  "RedHatEnterprise"  OR  "${UNIX_DIST} "  MATCHES  "^Fedora"  ) # RHEL/Fedora 
8696  if  ( "${UNIX_CODENAME} "  MATCHES  "Santiago"  ) # el6 
87-     set  ( WRAPPER_COMMAND "scl enable mantidlibs"  )
97+     set  ( WRAPPER_PREFIX "scl enable mantidlibs \" "  )
98+     set  ( WRAPPER_POSTFIX  "\" "  )
8899    set  ( EXTRA_LDPATH "/usr/lib64/paraview"  )
89100  else ()
90-     set  ( WRAPPER_COMMAND "eval"  )
101+     set  ( WRAPPER_PREFIX ""  )
102+     set  ( WRAPPER_POSTFIX  ""  )
91103  endif ()
92104
93105  if  ( NOT  MPI_BUILD )
@@ -106,7 +118,8 @@ if ( "${UNIX_DIST}" MATCHES "RedHatEnterprise" OR "${UNIX_DIST}" MATCHES "^Fedor
106118    set  ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${POST_UNINSTALL_FILE}  )
107119  endif ()
108120elseif  ( "${UNIX_DIST} "  MATCHES  "Ubuntu"  )
109-   set  ( WRAPPER_COMMAND "eval"  )
121+   set  ( WRAPPER_PREFIX ""  )
122+   set  ( WRAPPER_POSTFIX  ""  )
110123
111124  if  ( NOT  MPI_BUILD )
112125    configure_file  ( ${CMAKE_MODULE_PATH} /Packaging/deb/scripts/deb_pre_inst.in
0 commit comments