From 187a771f594a3b96caad7f6f15827874d3308ef5 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 27 Oct 2016 18:47:54 -0400 Subject: Add support for lib_dirs to gn_to_cmake.py. The vulcan code uses lib_dirs to point to the libs in the SDK. Change-Id: I4a1a4235b8534f3f937640b10f9758b0c70434c9 Reviewed-on: https://skia-review.googlesource.com/4003 Reviewed-by: Herb Derby Commit-Queue: Ben Wagner --- gn/gn_to_cmake.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'gn/gn_to_cmake.py') diff --git a/gn/gn_to_cmake.py b/gn/gn_to_cmake.py index 86906f524d..8b4f48479f 100644 --- a/gn/gn_to_cmake.py +++ b/gn/gn_to_cmake.py @@ -579,6 +579,10 @@ def WriteTarget(out, target, project): # Non-OBJECT library dependencies. external_libraries = target.properties.get('libs', []) if target.cmake_type.is_linkable and (external_libraries or libraries): + library_dirs = target.properties.get('lib_dirs', []) + if library_dirs: + SetVariableList(out, '${target}__library_directories', library_dirs) + system_libraries = [] for external_library in external_libraries: if '/' in external_library: @@ -586,12 +590,19 @@ def WriteTarget(out, target, project): else: if external_library.endswith('.framework'): external_library = external_library[:-len('.framework')] - system_library = external_library + '__library' + system_library = 'library__' + external_library + if library_dirs: + system_library = system_library + '__for_${target}' out.write('find_library("') out.write(CMakeStringEscape(system_library)) out.write('" "') out.write(CMakeStringEscape(external_library)) - out.write('")\n') + out.write('"') + if library_dirs: + out.write(' PATHS "') + WriteVariable(out, '${target}__library_directories') + out.write('"') + out.write(')\n') system_libraries.append(system_library) out.write('target_link_libraries("${target}"') for library in libraries: -- cgit v1.2.3