class CKick::Library

represents an library target (in respect to CMake add_library() command)

Public Class Methods

new(args={}) click to toggle source
  • args - Target hash (directly a CKickfile library target element's hash parsed with keys as Symbol), must be a Hash

CKick::Library specific input hash keys (in addition of CKick::Target ones)
  • :shared - whether or not this library should be a dynamic library (shared object) or a static library (archive)

Calls superclass method
# File lib/ckick/library.rb, line 15
def initialize args={}
  super args

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

Public Instance Methods

cmake() click to toggle source

CMakeLists content of the target

# File lib/ckick/library.rb, line 31
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_hash() click to toggle source

converts to Hash (for CKickfile)

Calls superclass method
# File lib/ckick/library.rb, line 22
def to_hash
  if @shared
    return super
  else
    return super.without(:shared)
  end
end