Class: Ritsu::SrcFiles::TargetCmakeLists::SourceFilesTemplate
- 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) ⇒ SourceFilesTemplate
constructor
A new instance of SourceFilesTemplate.
- #src_files_var_name ⇒ Object
- #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) ⇒ SourceFilesTemplate
Returns a new instance of SourceFilesTemplate.
62 63 64 65 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 62 def initialize(target) super("TargetCmakeLists -- #{target.name} -- Source Files") @target = target end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
60 61 62 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 60 def target @target end |
Instance Method Details
#src_files_var_name ⇒ Object
67 68 69 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 67 def src_files_var_name target.name.upcase + "_SRC_FILES" end |
#update_block(block, options = {}) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ritsu/src_files/target_cmake_lists.rb', line 71 def update_block(block, = {}) block.contents.clear block.contents << "SET(#{src_files_var_name}" src_files = target.src_files.to_a src_files.sort! {|x,y| x.src_path <=> y.src_path} src_files.each do |src_file| block.contents << " ${CMAKE_SOURCE_DIR}/#{src_file.src_path}" if src_file.include_in_source_files? end block.contents << ")" end |