Class: CKick::Library

Inherits:
Target
  • Object
show all
Defined in:
lib/ckick/library.rb

Instance Method Summary collapse

Methods inherited from Target

#create_structure, #paths, #to_s

Methods included from Hashable

#to_no_empty_value_hash

Constructor Details

#initialize(args = {}) ⇒ Library

Returns a new instance of Library.



10
11
12
13
14
# File 'lib/ckick/library.rb', line 10

def initialize args={}
  super args

  @shared = args[:shared] || false
end

Instance Method Details

#cmakeObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ckick/library.rb', line 24

def cmake
  res = []

  res << "add_library(#{@name}#{@shared ? " SHARED " : " "}#{@source.join(' ')})"

  unless @libs.empty?
    res << "target_link_libraries(#{@name} #{@libs.join(' ')})"
  end

  res.join("\n")
end

#to_hashObject



16
17
18
19
20
21
22
# File 'lib/ckick/library.rb', line 16

def to_hash
  if @shared
    return super
  else
    return super.without(:shared)
  end
end