Class: Ritsu::SrcFiles::ProjectCmakeLists::FakeInstallTemplate
- Defined in:
- lib/ritsu/ext/fake_install/src_files/project_cmake_lists.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Attributes included from BlockMixin
#contents, #id, #indent_length, #indent_level, #local_indentation
Instance Method Summary collapse
-
#initialize(project) ⇒ FakeInstallTemplate
constructor
A new instance of FakeInstallTemplate.
- #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(project) ⇒ FakeInstallTemplate
Returns a new instance of FakeInstallTemplate.
9 10 11 12 |
# File 'lib/ritsu/ext/fake_install/src_files/project_cmake_lists.rb', line 9 def initialize(project) super("ProjectCmakeLists -- Fake Install") @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'lib/ritsu/ext/fake_install/src_files/project_cmake_lists.rb', line 7 def project @project end |
Instance Method Details
#update_block(block, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ritsu/ext/fake_install/src_files/project_cmake_lists.rb', line 14 def update_block(block, ={}) block.contents.clear to_install = project.targets.select { |x| x.install? } to_install.sort! {|x,y| x.name <=> y.name } if project.performs_fake_install? && to_install.length > 0 block.add_line "ADD_CUSTOM_TARGET(fake_install" block.add_line " ALL" block.add_line " \"${CMAKE_COMMAND}\"" block.add_line " -D CMAKE_INSTALL_PREFIX:string=${CMAKE_SOURCE_DIR}/../" block.add_line " -P \"${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake\"" block.add_line " DEPENDS" to_install.each do |target| block.add_line " #{target.name}" end block.add_line ")" end end |