Class: CKick::Library
Overview
represents an library target (in respect to CMake add_library() command)
Instance Method Summary collapse
-
#cmake ⇒ Object
CMakeLists content of the target.
-
#initialize(args = {}) ⇒ Library
constructor
-
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).
-
-
#to_hash ⇒ Object
converts to Hash (for CKickfile).
Methods inherited from Target
#create_structure, #paths, #to_s
Methods included from Hashable
Constructor Details
#initialize(args = {}) ⇒ Library
-
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)
15 16 17 18 19 |
# File 'lib/ckick/library.rb', line 15 def initialize args={} super args @shared = args[:shared] || false end |
Instance Method Details
#cmake ⇒ Object
CMakeLists content of the target
31 32 33 34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
converts to Hash (for CKickfile)
22 23 24 25 26 27 28 |
# File 'lib/ckick/library.rb', line 22 def to_hash if @shared return super else return super.without(:shared) end end |