aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/gn_to_cmake.py
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2016-10-27 18:47:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-28 15:07:10 +0000
commit187a771f594a3b96caad7f6f15827874d3308ef5 (patch)
tree4a464e7ceba0c21fc29c24842b3e5c0b8ae39e09 /gn/gn_to_cmake.py
parent2ce47630fe20feaa11f16e390d3f6f5fc13d1f2b (diff)
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 <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'gn/gn_to_cmake.py')
-rw-r--r--gn/gn_to_cmake.py15
1 files changed, 13 insertions, 2 deletions
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: