public  function get_install_name_flags(self, target_dir, target_name) result(flags)  
    
    Generate install_name flag for a shared library build on macOS
    Type Bound
    compiler_t
    Arguments
        
    
      
        | Type | Intent | Optional | Attributes |  | Name |  | 
    
        
            | class(compiler_t), | intent(in) |  |  | :: | self |  | 
        
            | character(len=*), | intent(in) |  |  | :: | target_dir |  | 
        
            | character(len=*), | intent(in) |  |  | :: | target_name |  | 
    
  
      Return Value
        
          
          character(len=:), allocatable
        
      
      
    
        
      Variables
      
    
      
        | Type | Visibility | Attributes |  | Name |  | Initial |  | 
    
        
            | character(len=:), | public, | allocatable | :: | library_file |  |  |  | 
    
  
    
    
    
    
    
    
    
    
    Source Code
    function get_install_name_flags(self, target_dir, target_name) result(flags)
    class(compiler_t), intent(in) :: self
    character(len=*), intent(in) :: target_dir, target_name
    character(len=:), allocatable :: flags
    character(len=:), allocatable :: library_file
    if (get_os_type() /= OS_MACOS) then
        flags = ""
        return
    end if
    ! Shared library basename (e.g., libfoo.dylib)
    if (str_ends_with(target_name, ".dylib")) then
        library_file = target_name        
    else
        library_file = library_filename(target_name,.true.,.false.,OS_MACOS)
    end if
    
    flags = " -Wl,-install_name,@rpath/" // library_file
end function get_install_name_flags