From fafdb65cf8ec46243e5fd5aa7bc2ef6b57ded006 Mon Sep 17 00:00:00 2001
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Date: Thu, 20 Jul 2017 20:09:24 +0300
Subject: [PATCH] xrow: build xrow as a static library

Part of #2507
---
 src/box/CMakeLists.txt   |  9 ++++-----
 src/box/vclock.c         |  1 -
 test/unit/CMakeLists.txt | 10 ++--------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index 7624d0d447..c1f85ee277 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -19,12 +19,12 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
 
 include_directories(${ZSTD_INCLUDE_DIRS})
 
+add_library(xrow STATIC xrow.c iproto_constants.c vclock.c errcode.c)
+target_link_libraries(xrow server core small)
+
 add_library(box STATIC
     iproto.cc
-    iproto_constants.c
-    errcode.c
     error.cc
-    xrow.c
     xrow_io.cc
     xlog.cc
     tuple_format.c
@@ -76,7 +76,6 @@ add_library(box STATIC
     user_def.c
     user.cc
     authentication.cc
-    vclock.c
     replication.cc
     recovery.cc
     xstream.cc
@@ -102,5 +101,5 @@ add_library(box STATIC
     lua/xlog.c
     ${bin_sources})
 
-target_link_libraries(box ${ZSTD_LIBRARIES} ${common_libraries})
+target_link_libraries(box xrow ${ZSTD_LIBRARIES} ${common_libraries})
 add_dependencies(box build_bundled_libs)
diff --git a/src/box/vclock.c b/src/box/vclock.c
index da18177df4..2189ea8ebc 100644
--- a/src/box/vclock.c
+++ b/src/box/vclock.c
@@ -34,7 +34,6 @@
 #include <stdarg.h>
 #include <ctype.h>
 
-#include "say.h"
 #include "diag.h"
 
 int64_t
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 59400dadbb..e86f4c980c 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -53,19 +53,13 @@ target_link_libraries(light.test small)
 add_executable(bloom.test bloom.cc)
 target_link_libraries(bloom.test salad)
 add_executable(vclock.test vclock.cc unit.c
-    ${CMAKE_SOURCE_DIR}/src/box/vclock.c
-    ${CMAKE_SOURCE_DIR}/src/box/errcode.c
     ${CMAKE_SOURCE_DIR}/src/box/error.cc
     ${CMAKE_SOURCE_DIR}/src/rmean.c
     ${CMAKE_SOURCE_DIR}/src/histogram.c)
-target_link_libraries(vclock.test core salad small)
+target_link_libraries(vclock.test xrow core salad small)
 add_executable(xrow.test xrow.cc unit.c
-    ${CMAKE_SOURCE_DIR}/src/box/xrow.c
-    ${CMAKE_SOURCE_DIR}/src/box/vclock.c
-    ${CMAKE_SOURCE_DIR}/src/box/iproto_constants.c
-    ${CMAKE_SOURCE_DIR}/src/box/errcode.c
     ${CMAKE_SOURCE_DIR}/src/box/error.cc)
-target_link_libraries(xrow.test server misc ${MSGPUCK_LIBRARIES})
+target_link_libraries(xrow.test server misc xrow ${MSGPUCK_LIBRARIES})
 
 add_executable(fiber.test fiber.cc unit.c)
 set_source_files_properties(fiber.cc PROPERTIES COMPILE_FLAGS -O0)
-- 
GitLab