Class: Ritsu::SrcFiles::TargetCmakeLists::LibrariesTemplate
- Defined in:
- lib/ritsu/src_files/target_cmake_lists.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
Attributes included from BlockMixin
#contents, #id, #indent_length, #indent_level, #local_indentation
Instance Method Summary collapse
-
#initialize(target) ⇒ LibrariesTemplate
constructor
A new instance of LibrariesTemplate.
- #update_block(block, options = {}) ⇒ Object
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) ⇒ LibrariesTemplate
Returns a new instance of LibrariesTemplate.
13 14 15 16 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 13 def initialize(target) super("TargetCmakeLists -- #{target.name} -- Libraries") @target = target end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
11 12 13 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 11 def target @target end |
Instance Method Details
#update_block(block, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 18 def update_block(block, = {}) external_libraries = target.dependency_libraries.to_a external_libraries.sort! {|x,y| x.name <=> y.name} dependency_targets = target.dependency_targets.to_a dependency_targets.sort! {|x,y| x.name <=> y.name} block.contents.clear external_libraries.each do |external_library| block.contents << external_library.cmake_depend_script end dependency_targets.each do |dependency_target| if dependency_target.cmake_depend_script.strip.length > 0 block.contents << dependency_target.cmake_depend_script end end if target.library? if target.cmake_depend_script.strip.length > 0 block.contents << target.cmake_depend_script end end end |