Class: Ritsu::SrcFiles::TargetCmakeLists::InstallTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/ritsu/src_files/target_cmake_lists.rb

Instance Attribute Summary collapse

Attributes included from BlockMixin

#contents, #id, #indent_length, #indent_level, #local_indentation

Instance Method Summary collapse

Methods inherited from Template

#add_content, #add_template, #child_template_with_id, #child_template_with_id_position, #child_templates, #create_block

Methods included from BlockMixin

#add_line, #add_new_line, #block_structure?, #clear_contents, #indent, #initialize_block_mixin, #outdent

Constructor Details

#initialize(target) ⇒ InstallTemplate

Returns a new instance of InstallTemplate.



122
123
124
125
126
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 122

def initialize(target)
  super("TargetCmakeLists -- #{target.name} -- Install")
  @target = target
  
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



120
121
122
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 120

def target
  @target
end

Instance Method Details

#update_block(block, options = {}) ⇒ Object



128
129
130
131
132
133
134
135
136
137
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 128

def update_block(block, options = {})
  block.contents.clear
  
  if target.install?
    block.add_line "INSTALL(TARGETS #{target.name}"
    block.add_line "    RUNTIME DESTINATION bin"
    block.add_line "    LIBRARY DESTINATION lib"
    block.add_line ")"
  end
end