Class: Ritsu::SrcFiles::ProjectCmakeLists::HeaderTemplate

Inherits:
Template
  • Object
show all
Includes:
TemplatePolicies::Overwrite
Defined in:
lib/ritsu/src_files/project_cmake_lists.rb

Instance Attribute Summary

Attributes included from BlockMixin

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

Instance Method Summary collapse

Methods included from TemplatePolicies::Overwrite

#overwrite_block, #update_block

Methods inherited from Template

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

Methods included from BlockMixin

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

Constructor Details

#initialize(project) ⇒ HeaderTemplate

Returns a new instance of HeaderTemplate.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ritsu/src_files/project_cmake_lists.rb', line 11

def initialize(project)
  super("ProjectCmakeLists -- Header")
  @project = project
  
  add_line "PROJECT(#{@project.name})"
  add_line "CMAKE_MINIMUM_REQUIRED(VERSION 2.8)"
  add_line "SET(CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake_modules\" ${CMAKE_MODULE_PATH})"
  add_new_line
  add_line "IF(WIN32)"
  add_line '    OPTION(__WIN_PLATFORM__ "Windows Platform" ON)'
  add_line "ELSE(WIN32)"
  add_line '    OPTION(__WIN_PLATFORM__ "Windows Platform" OFF)'
  add_line "ENDIF(WIN32)"
  add_new_line
  add_line "IF(UNIX)"
  add_line "    IF(APPLE)"          
  add_line '        OPTION(__MAC_PLATFORM__ "Apple Platform" ON)'
  add_line '        OPTION(__UNIX_PLATFORM__ "Unix Platform" OFF)'
  add_line "    ELSE(APPLE)"
  add_line '        OPTION(__MAC_PLATFORM__ "Apple Platform" OFF)'
  add_line '        OPTION(__UNIX_PLATFORM__ "Unix Platform" ON)'
  add_line "    ENDIF(APPLE)"
  add_line "ELSE(UNIX)"
  add_line '    OPTION(__MAC_PLATFORM__ "Apple Platform" OFF)'
  add_line '    OPTION(__UNIX_PLATFORM__ "Unix Platform" OFF)'
  add_line "ENDIF(UNIX)"
end