Class: CKick::LibraryLink

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

Overview

Represents a library link (-l compiler option or library name to be passed to CMake target_link_libraries() function)

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ LibraryLink

initializes object with an Hash hash keys:

  • :name - library name (lib#name.a/.so) as is



15
16
17
18
19
# File 'lib/ckick/library_link.rb', line 15

def initialize args={}
  name = args[:name] || ""
  raise CKick::IllegalInitializationError, "No name provided to library link" unless name.is_a?(String) && !name.empty?
  @name = name
end

Instance Method Details

#cmakeObject

cmake code content (only library name, not command)



39
40
41
# File 'lib/ckick/library_link.rb', line 39

def cmake
  @name
end

#raw_flagObject

corresponding compiler link flag (-l option)



34
35
36
# File 'lib/ckick/library_link.rb', line 34

def raw_flag
  "-l#{@name}"
end

#to_hash_elementObject

converts to hashable element name as is



23
24
25
# File 'lib/ckick/library_link.rb', line 23

def to_hash_element
  @name
end

#to_sObject

converts to String name as is



29
30
31
# File 'lib/ckick/library_link.rb', line 29

def to_s
  @name
end