diff --git a/CMakeLists.txt b/CMakeLists.txt
index a15af18534044231f0a5686b15d858c309f899fa..a5aee720e71552abd8fc5245d4b4f24e73063589 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -380,13 +380,26 @@ macro(nebula_add_test)
     endif()
 endmacro()
 
-macro(nebula_build_after_base obj_name)
-    add_dependencies(${obj_name} base_obj)
-endmacro()
-
+# For simplicity, we make all ordinary libraries depend on the compile-time generated files,
+# including the precompiled header, a.k.a Base.h.gch, and thrift headers.
 macro(nebula_add_library name type)
     add_library(${name} ${type} ${ARGN})
-    nebula_build_after_base(${name})
+    if (PCHSupport_FOUND)
+        add_dependencies(
+            ${name}
+            base_obj_gch
+        )
+    endif()
+    add_dependencies(
+        ${name}
+        common_thrift_headers
+        graph_thrift_headers
+        storage_thrift_headers
+        meta_thrift_headers
+        raftex_thrift_headers
+        hbase_thrift_headers
+        parser_target
+    )
 endmacro()
 
 include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/bzip2/include)
diff --git a/src/executor/CMakeLists.txt b/src/executor/CMakeLists.txt
index 78f3c45f7cc746d18f07f4fd443a52ef92cae1f1..16676818977371ae44c7691a72a98757df667337 100644
--- a/src/executor/CMakeLists.txt
+++ b/src/executor/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_library(
+nebula_add_library(
     graph_obj OBJECT
     GraphFlags.cpp
     GraphService.cpp
@@ -49,27 +49,11 @@ add_library(
     MatchExecutor.cpp
     DeleteVertexExecutor.cpp
 )
-add_dependencies(
-    graph_obj
-    parser_obj
-    graph_thrift_obj
-    meta_thrift_obj
-    meta_client
-    gflags_man_obj
-    schema_obj
-    stats_obj
-    process_obj
-    base_obj
-)
 
-add_library(
+nebula_add_library(
     graph_http_handler OBJECT
     GraphHttpHandler.cpp
 )
-add_dependencies(
-    graph_http_handler
-    base_obj
-)
 
 nebula_add_subdirectory(test)
 
diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt
index 43f51cf73e1235f72bf01b65f09872ddb39cff03..1ce1710fdf8da7136662a2e908c1eb1cea4e84a5 100644
--- a/src/parser/CMakeLists.txt
+++ b/src/parser/CMakeLists.txt
@@ -4,6 +4,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 bison_target(Parser parser.yy ${CMAKE_CURRENT_BINARY_DIR}/GraphParser.cpp COMPILE_FLAGS "-Werror")
 flex_target(Scanner scanner.lex ${CMAKE_CURRENT_BINARY_DIR}/GraphScanner.cpp)
 
+add_custom_target(parser_target DEPENDS ${FLEX_Scanner_OUTPUTS} ${BISON_Parser_OUTPUTS})
+
 add_flex_bison_dependency(Scanner Parser)
 
 add_compile_options(-Wno-error=sign-compare)