lib/arli/lock/formats/template/cmake_renderer.rb in arli-1.1.0 vs lib/arli/lock/formats/template/cmake_renderer.rb in arli-1.2.1
- old
+ new
@@ -64,9 +64,27 @@
def library_path
config.libraries.path
end
+ def libraries_with_dependencies
+ libraries.select(&:depends)
+ end
+
+ def library_by_name(name)
+ libraries.find { |l| l.name.downcase == name.downcase }
+ end
+
+ def dependencies(lib)
+ return nil unless lib.depends
+ lib.depends.map { |name| library_by_name(name) }
+ end
+
+ def cmake_dependencies(lib)
+ return nil unless lib.depends
+ "set(#{lib.canonical_dir}_DEPENDS_ON_LIBS #{dependencies(lib).map(&:canonical_dir).join(' ')})"
+ end
+
def arli_library_path
if library_path.start_with?('/')
"#{library_path}"
elsif library_path.start_with?('~')
"$ENV{HOME}#{library_path[1..-1]}"