From 58c26ac03a4510bd70ac283e38a8261faf23e387 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 31 Oct 2018 13:41:32 +0000
Subject: [PATCH] Link Python extension module to shared LIEF library

.. when sahred libraries are enabled (BUILD_SHARED_LIBS)
---
 api/python/CMakeLists.txt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/api/python/CMakeLists.txt b/api/python/CMakeLists.txt
index be3c309..ccd0c69 100644
--- a/api/python/CMakeLists.txt
+++ b/api/python/CMakeLists.txt
@@ -124,11 +124,17 @@ set_property(TARGET pyLIEF PROPERTY CXX_STANDARD_REQUIRED ON)
 
 if (MSVC)
   target_compile_options(pyLIEF PUBLIC /FIiso646.h)
-	set_property(TARGET pyLIEF PROPERTY LINK_FLAGS /NODEFAULTLIB:MSVCRT)
+  if (NOT BUILD_SHARED_LIBS)
+    set_property(TARGET pyLIEF PROPERTY LINK_FLAGS /NODEFAULTLIB:MSVCRT)
+  endif (NOT BUILD_SHARED_LIBS)
 endif()
 
 set_target_properties(pyLIEF PROPERTIES PYTHON_VERSION ${PYTHON_VERSION})
-set(PYLIEF_DEPS_LIBRARIES LIB_LIEF_STATIC)
+if(BUILD_SHARED_LIBS)
+  set(PYLIEF_DEPS_LIBRARIES LIB_LIEF_SHARED)
+else(BUILD_SHARED_LIBS)
+  set(PYLIEF_DEPS_LIBRARIES LIB_LIEF_STATIC)
+endif(BUILD_SHARED_LIBS)
 
 if(LIEF_COVERAGE)
   target_compile_options(pyLIEF PRIVATE -g -O0 --coverage -fprofile-arcs -ftest-coverage)
-- 
2.17.2 (Apple Git-113)
