Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit c83e49f

Browse files
tcm-marcelapavlo
authored andcommitted
Change cmake to build libpg_query in build folder manually (instead of using Makefile)
1 parent 19e3f93 commit c83e49f

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ peloton_default_properties(peloton-proto)
3232

3333
# --[ Libpg_query library
3434

35-
add_custom_target(libpg_query ALL
36-
COMMAND ${CMAKE_MAKE_PROGRAM}
37-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third_party/libpg_query/
38-
COMMENT "Original libpg makefile target")
35+
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/libpg_query/ libpg_query.a)
3936

4037

4138
##################################################################################
@@ -46,9 +43,8 @@ add_custom_target(libpg_query ALL
4643
peloton_pickup_peloton_sources(${PROJECT_SOURCE_DIR})
4744

4845
add_library(peloton SHARED ${srcs})
49-
add_dependencies(peloton libpg_query)
50-
target_link_libraries(peloton ${Peloton_LINKER_LIBS}
51-
${PROJECT_SOURCE_DIR}/third_party/libpg_query/libpg_query.a)
46+
47+
target_link_libraries(peloton PUBLIC ${Peloton_LINKER_LIBS} peloton-proto PRIVATE pg_query)
5248

5349
peloton_default_properties(peloton)
5450
set_target_properties(peloton PROPERTIES
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cmake_minimum_required(VERSION 2.8.7)
2+
3+
# ---[ Peloton project
4+
project(pg_query CXX C)
5+
6+
# this code imitates the Makefile in /third_party/libpg_query/
7+
file(GLOB_RECURSE pg_query_srcs ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c)
8+
list(REMOVE_ITEM pg_query_srcs
9+
"${CMAKE_CURRENT_SOURCE_DIR}/src/pg_query_fingerprint_defs.c"
10+
"${CMAKE_CURRENT_SOURCE_DIR}/src/pg_query_fingerprint_conds.c"
11+
"${CMAKE_CURRENT_SOURCE_DIR}/src/pg_query_json_defs.c"
12+
"${CMAKE_CURRENT_SOURCE_DIR}/src/pg_query_json_conds.c"
13+
"${CMAKE_CURRENT_SOURCE_DIR}/src/postgres/guc-file.c"
14+
"${CMAKE_CURRENT_SOURCE_DIR}/src/postgres/scan.c"
15+
"${CMAKE_CURRENT_SOURCE_DIR}/src/pg_query_json_helper.c")
16+
17+
include_directories(.)
18+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/postgres/include)
19+
20+
add_library(pg_query STATIC ${pg_query_srcs})
21+
22+
set_target_properties(pg_query PROPERTIES LINKER_LANGUAGE C)
23+
set_target_properties(pg_query PROPERTIES POSITION_INDEPENDENT_CODE ON)

0 commit comments

Comments
 (0)