Skip to content

Commit fa3466f

Browse files
committed
use_cmakelists()
1 parent c68d38f commit fa3466f

File tree

3 files changed

+53
-44
lines changed

3 files changed

+53
-44
lines changed

CMakeLists.txt

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
cmake_minimum_required(VERSION 3.0.0)
1+
# Generated by cynkrathis::use_cmakelists(), do not edit by hand
2+
#
3+
# Call:
4+
# quote(cynkrathis::use_cmakelists())
5+
6+
cmake_minimum_required(VERSION 3.14)
27
project(RPostgres VERSION 0.1.0)
38

49
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
510

6-
include(CTest)
7-
enable_testing()
8-
911
add_subdirectory(src)
10-
11-
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
12-
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
13-
include(CPack)

src/CMakeLists.txt

+37-36
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,59 @@
1-
add_library(RPostgres
2-
connection.cpp
1+
# Generated by cynkrathis::use_cmakelists(), do not edit by hand
2+
#
3+
# Call:
4+
# quote(cynkrathis::use_cmakelists())
5+
6+
add_library(RPostgres
37
DbColumn.cpp
8+
DbColumn.h
49
DbColumnDataSource.cpp
10+
DbColumnDataSource.h
511
DbColumnDataSourceFactory.cpp
6-
DbColumnStorage.cpp
7-
DbConnection.cpp
8-
DbDataFrame.cpp
9-
DbResult.cpp
10-
encode.cpp
11-
encrypt.cpp
12-
logging.cpp
13-
PqColumnDataSource.cpp
14-
PqColumnDataSourceFactory.cpp
15-
PqDataFrame.cpp
16-
PqResult.cpp
17-
PqResultImpl.cpp
18-
PqResultSource.cpp
19-
PqUtils.cpp
20-
RcppExports.cpp
21-
result.cpp
2212
DbColumnDataSourceFactory.h
23-
DbColumnDataSource.h
2413
DbColumnDataType.h
25-
DbColumn.h
14+
DbColumnStorage.cpp
2615
DbColumnStorage.h
16+
DbConnection.cpp
2717
DbConnection.h
18+
DbDataFrame.cpp
2819
DbDataFrame.h
20+
DbResult.cpp
2921
DbResult.h
30-
DbResultImplDecl.h
3122
DbResultImpl.h
32-
encode.h
33-
integer64.h
34-
pch.h
35-
PqColumnDataSourceFactory.h
23+
DbResultImplDecl.h
24+
PqColumnDataSource.cpp
3625
PqColumnDataSource.h
26+
PqColumnDataSourceFactory.cpp
27+
PqColumnDataSourceFactory.h
28+
PqDataFrame.cpp
3729
PqDataFrame.h
30+
PqResult.cpp
3831
PqResult.h
32+
PqResultImpl.cpp
3933
PqResultImpl.h
34+
PqResultSource.cpp
4035
PqResultSource.h
36+
PqUtils.cpp
4137
PqUtils.h
4238
RPostgres-init.c
4339
RPostgres_types.h
40+
RcppExports.cpp
41+
connection.cpp
42+
encode.cpp
43+
encode.h
44+
encrypt.cpp
45+
integer64.h
46+
logging.cpp
47+
pch.h
48+
result.cpp
4449
)
4550

46-
target_include_directories(RPostgres PUBLIC
47-
"/usr/share/R/include"
48-
"/home/gitpod/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include/"
49-
"/home/gitpod/R/x86_64-pc-linux-gnu-library/3.6/plogr/include/"
50-
"/usr/include/postgresql"
51-
"vendor"
52-
)
51+
execute_process(COMMAND bash "-c" "Rscript -e 'cat(R.home(\"include\"))'" OUTPUT_VARIABLE R_INCLUDE)
52+
execute_process(COMMAND bash "-c" "Rscript -e 'x <- desc::desc_get_deps(); pkgs <- x$package[x$type == \"LinkingTo\"]; paths <- file.path(.libPaths()[[1]], pkgs, \"include\"); cat(paths, sep = \";\")'" OUTPUT_VARIABLE R_LIBRARIES_INCLUDES)
5353

54-
target_compile_definitions(RPostgres PUBLIC
55-
"RCPP_DEFAULT_INCLUDE_CALL=false"
56-
"RCPP_USING_UTF8_ERROR_STRING"
57-
"BOOST_NO_AUTO_PTR"
54+
target_include_directories(RPostgres PUBLIC
55+
${R_INCLUDE}
56+
${R_LIBRARIES_INCLUDES}
5857
)
58+
59+
include(./custom.cmake OPTIONAL)

src/custom.cmake

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
target_include_directories(RPostgres PUBLIC
2+
"/usr/include/postgresql"
3+
"vendor"
4+
)
5+
6+
target_compile_definitions(RPostgres PUBLIC
7+
"RCPP_DEFAULT_INCLUDE_CALL=false"
8+
"RCPP_USING_UTF8_ERROR_STRING"
9+
"BOOST_NO_AUTO_PTR"
10+
)

0 commit comments

Comments
 (0)