[tarantool-patches] [PATCH] cmake: make sure yaml is built statically when used in tarantool

Serge Petrenko sergepetrenko at tarantool.org
Tue Jul 23 00:47:09 MSK 2019


Follow-up tarantool/tarantool#4090
---
https://github.com/tarantool/libyaml/tree/sp/static-linking
https://github.com/tarantool/tarantool/issues/4090

CMakeLists.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cc8ccf..6d3ed0f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,9 +52,13 @@ configure_file(
   ${config_h}
   )
 
-add_library(yaml ${SRCS})
+if(ENABLE_BUNDLED_LIBYAML)
+  add_library(yaml STATIC ${SRCS})
+else()
+  add_library(yaml ${SRCS})
+endif()
 
-if(NOT BUILD_SHARED_LIBS)
+if(NOT BUILD_SHARED_LIBS OR ENABLE_BUNDLED_LIBYAML)
   set_target_properties(yaml
     PROPERTIES OUTPUT_NAME yaml_static
     )
@@ -67,7 +71,7 @@ set_target_properties(yaml
 target_compile_definitions(yaml
   PRIVATE HAVE_CONFIG_H
   PUBLIC
-    $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:YAML_DECLARE_STATIC>
+    $<$<OR:$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>,$<BOOL:${ENABLE_BUNDLED_LIBYAML}>>:YAML_DECLARE_STATIC>
     $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
   )
 
-- 
2.20.1 (Apple Git-117)





More information about the Tarantool-patches mailing list