diff --git a/CMakeLists.txt b/CMakeLists.txt
index a04b1b8f6e835e956535498c739c563800eb4171..8530f1f88e9ac4e5d716f833d8372b8c9b23004f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,25 @@
+# Copyright (c) 2019 - present, VE Software Inc. All rights reserved
+#
+# This source code is licensed under Apache 2.0 License
+# (found in the LICENSE.Apache file in the root directory)
+#
+# The build can be controlled by defining following variables on the
+# <cmake> command line
+#
+#   CMAKE_C_COMPILER        -- Specify the compiler for C language
+#   CMAKE_CXX_COMPILER      -- Specify the compiler for C++ language
+#   FLEX_EXECUTABLE         -- Specify the full path of flex executable
+#   VGRAPH_GPERF_BIN_DIR    -- Specify the full path to the directory
+#                              containing gperf binary
+#
+#   VGRAPH_KRB5_ROOT        -- Specify the root directory for KRB5
+#   VGRAPH_LIBUNWIND_ROOT   -- Specify the root directory for libunwind
+#   VGRAPH_OPENSSL_ROOT     -- Specify the root directory for openssl
+#   VGRAPH_BOOST_ROOT       -- Specify the root directory for boost
+#
 cmake_minimum_required(VERSION 3.0.0)
 
-project("vGraph" CXX)
+project("vGraph" C CXX)
 
 set(CMAKE_SKIP_RPATH TRUE)
 
@@ -31,10 +50,48 @@ set(VGRAPH_HOME ${CMAKE_CURRENT_SOURCE_DIR})
 # To include customized FindXXX.cmake modules
 set(CMAKE_MODULE_PATH "${VGRAPH_HOME}/cmake" ${CMAKE_MODULE_PATH})
 
-find_package(Boost)
-find_package(OpenSSL)
+if(NOT ${VGRAPH_KRB5_ROOT} STREQUAL "")
+    message(STATUS "Specified VGRAPH_KRB5_ROOT: " ${VGRAPH_KRB5_ROOT})
+    list(APPEND CMAKE_INCLUDE_PATH ${VGRAPH_KRB5_ROOT}/include)
+    list(APPEND CMAKE_LIBRARY_PATH ${VGRAPH_KRB5_ROOT}/lib)
+    list(APPEND CMAKE_PROGRAM_PATH ${VGRAPH_KRB5_ROOT}/bin)
+endif()
+
+if(NOT ${VGRAPH_LIBUNWIND_ROOT} STREQUAL "")
+    message(STATUS "Specified VGRAPH_LIBUNWIND_ROOT: " ${VGRAPH_LIBUNWIND_ROOT})
+    list(APPEND CMAKE_INCLUDE_PATH ${VGRAPH_LIBUNWIND_ROOT}/include)
+    list(APPEND CMAKE_LIBRARY_PATH ${VGRAPH_LIBUNWIND_ROOT}/lib)
+endif()
+
+if(NOT ${VGRAPH_OPENSSL_ROOT} STREQUAL "")
+    message(STATUS "Specified VGRAPH_OPENSSL_ROOT: " ${VGRAPH_OPENSSL_ROOT})
+    list(APPEND CMAKE_INCLUDE_PATH ${VGRAPH_OPENSSL_ROOT}/include)
+    list(APPEND CMAKE_LIBRARY_PATH ${VGRAPH_OPENSSL_ROOT}/lib)
+endif()
+
+if(NOT ${VGRAPH_BOOST_ROOT} STREQUAL "")
+    message(STATUS "Specified VGRAPH_BOOST_ROOT: " ${VGRAPH_BOOST_ROOT})
+    list(APPEND CMAKE_INCLUDE_PATH ${VGRAPH_BOOST_ROOT}/include)
+    list(APPEND CMAKE_LIBRARY_PATH ${VGRAPH_BOOST_ROOT}/lib)
+endif()
+
+if(NOT ${VGRAPH_GPERF_BIN_DIR} STREQUAL "")
+    message(STATUS "Specified VGRAPH_GPERF_BIN_DIR: " ${VGRAPH_GPERF_BIN_DIR})
+    list(APPEND CMAKE_PROGRAM_PATH ${VGRAPH_GPERF_BIN_DIR})
+endif()
+
+message(STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH})
+message(STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH})
+message(STATUS "CMAKE_PROGRAM_PATH: " ${CMAKE_PROGRAM_PATH})
+
+find_package(Boost REQUIRED)
+find_package(OpenSSL REQUIRED)
 find_package(Krb5 REQUIRED gssapi)
 find_package(PCHSupport)
+find_package(GPERF 2.8 REQUIRED)
+find_package(Libunwind REQUIRED)
+find_package(BISON REQUIRED)
+find_package(FLEX REQUIRED)
 
 add_compile_options(-Winvalid-pch)
 add_compile_options(-Wall)
@@ -92,7 +149,6 @@ set(THRIFT_LIBRARIES
     thriftcpp2
     thrift
     thriftprotocol
-    server
     async
     protocol
     transport
diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt
index ab6f377ff0fbfc03c69750dffd79b4bea334fbdc..5ccba161a28eeac8b03d869aa57b6acd794f54f0 100644
--- a/src/parser/CMakeLists.txt
+++ b/src/parser/CMakeLists.txt
@@ -1,8 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
-find_package(BISON)
-find_package(FLEX)
 bison_target(Parser parser.yy ${CMAKE_CURRENT_BINARY_DIR}/VGraphParser.cpp COMPILE_FLAGS "-Werror")
 flex_target(Scanner scanner.lex ${CMAKE_CURRENT_BINARY_DIR}/VGraphScanner.cpp)
 
diff --git a/src/parser/Clauses.h b/src/parser/Clauses.h
index 0ee103b4109a865b16de2c9999fc9cb6e0eadc44..49993a47f45d5ac91fedc9531e9b3a7d7d12dfe3 100644
--- a/src/parser/Clauses.h
+++ b/src/parser/Clauses.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_CLAUSES_H_
 #define PARSER_CLAUSES_H_
 
+#include "base/Base.h"
 #include "parser/Expressions.h"
 
 namespace vesoft {
diff --git a/src/parser/Expressions.h b/src/parser/Expressions.h
index 27587e5c0918f6ab8aa8ad0043679bccf6fcb965..3601731703c65a27e6136dc6f863a31e449c25a5 100644
--- a/src/parser/Expressions.h
+++ b/src/parser/Expressions.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_EXPRESSIONS_H_
 #define PARSER_EXPRESSIONS_H_
 
+#include "base/Base.h"
 #include <boost/variant.hpp>
 
 namespace vesoft {
diff --git a/src/parser/GQLParser.h b/src/parser/GQLParser.h
index 59456435b1cee3744013c051dd26d9972240234b..c51576377994a8ae1b15e8b9cee2e42c6798a60c 100644
--- a/src/parser/GQLParser.h
+++ b/src/parser/GQLParser.h
@@ -6,8 +6,7 @@
 #ifndef PARSER_GQLPARSER_H_
 #define PARSER_GQLPARSER_H_
 
-#include <sstream>
-#include <regex>
+#include "base/Base.h"
 #include "VGraphParser.hpp"
 #include "VGraphScanner.h"
 
diff --git a/src/parser/MaintainSentences.h b/src/parser/MaintainSentences.h
index 53e93df86dfb1750d0315c169a345faa909bd85d..cbfed43724ec4716f44ea7193226ba5d32130f4b 100644
--- a/src/parser/MaintainSentences.h
+++ b/src/parser/MaintainSentences.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_MAINTAINSENTENCES_H_
 #define PARSER_MAINTAINSENTENCES_H_
 
+#include "base/Base.h"
 #include "parser/Clauses.h"
 #include "parser/Sentence.h"
 
diff --git a/src/parser/MutateSentences.h b/src/parser/MutateSentences.h
index 5f92a6d9f4b61af36392219f743e397af8031ad2..ee979b44f821ad55fa73c4c46ffe7b8f424acc54 100644
--- a/src/parser/MutateSentences.h
+++ b/src/parser/MutateSentences.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_MUTATESENTENCES_H_
 #define PARSER_MUTATESENTENCES_H_
 
+#include "base/Base.h"
 #include "parser/Clauses.h"
 #include "parser/Sentence.h"
 
diff --git a/src/parser/Sentence.h b/src/parser/Sentence.h
index cb46eefea17b845c4bfbb924275b85124cbea148..d783d11d1ab0eea228544b3754e8c11daa37b536 100644
--- a/src/parser/Sentence.h
+++ b/src/parser/Sentence.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_SENTENCE_H_
 #define PARSER_SENTENCE_H_
 
+#include "base/Base.h"
 #include "parser/Expressions.h"
 
 namespace vesoft {
diff --git a/src/parser/Statement.h b/src/parser/Statement.h
index 25d71645da3958332f418b7c55fc0484e935176d..221ce1a14dbb88cb262f18312ae794e22f5387f4 100644
--- a/src/parser/Statement.h
+++ b/src/parser/Statement.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_STATEMENT_H_
 #define PARSER_STATEMENT_H_
 
+#include "base/Base.h"
 #include "parser/MaintainSentences.h"
 #include "parser/TraverseSentences.h"
 #include "parser/MutateSentences.h"
diff --git a/src/parser/TraverseSentences.h b/src/parser/TraverseSentences.h
index 96c49150e827107ff7754282cb5fdd67522180c0..aed6fc007c081dc9bbaee92015302e6d107a4fc4 100644
--- a/src/parser/TraverseSentences.h
+++ b/src/parser/TraverseSentences.h
@@ -6,6 +6,7 @@
 #ifndef PARSER_TRAVERSESENTENCES_H_
 #define PARSER_TRAVERSESENTENCES_H_
 
+#include "base/Base.h"
 #include "parser/Sentence.h"
 #include "parser/Clauses.h"
 
diff --git a/src/parser/VGraphScanner.h b/src/parser/VGraphScanner.h
index 5a593412fbb8ba99109ac4e85cfe1f0e710ec51d..bbd7e510943e603502a37debd0e73b77ee55f97c 100644
--- a/src/parser/VGraphScanner.h
+++ b/src/parser/VGraphScanner.h
@@ -6,6 +6,8 @@
 #ifndef PARSER_VGRAPHSCANNER_H_
 #define PARSER_VGRAPHSCANNER_H_
 
+#include "base/Base.h"
+
 // Only include FlexLexer.h if it hasn't been already included
 #if !defined(yyFlexLexerOnce)
 #include <FlexLexer.h>