[Rcpp-devel] Using CMakeLists.txt

Etienne B. Racine etiennebr at gmail.com
Tue Mar 5 18:21:01 CET 2013


I'd like to use a PCL algorithm inside R and they provide a CMakeLists.txt
for configuration. I haven't found how to directly use the CMakeLists.txt
in building R package, however when I run `make .` form src, I can generate
a Makefile  that nearly works with `R CMD INSTALL --no-multiarch`.

It does compile correctly my .cpp, however I get
`Error in library.dynam(lib, package, package.lib) :  shared object
‘my_package.so’ not found`

Here's the CMakeFileLists.txt :
```
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

find_package(PCL 1.6 REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable (segmentation segmentation.cpp)
target_link_libraries (segmentation ${PCL_LIBRARIES})
```
I've seen that using a makefile wasn't the best practice [1] (I should move
it to makevars). Since my CMakeFileLists is apparently simple (e.g.
compared to RInside examples), I guess I could move it to makevars however
I'm not familiar with cmake nor makevars, so I was wondering if there was
documentation about translating from one to the other. However I'm
absolutely not sure this is the real problem (using the CMakeLists.txt).

(I'm using R version 2.15.2 (2012-10-26) on x86_64-pc-linux-gnu (64-bit),
building from RStudio.)

Etienne

[1]:
http://stackoverflow.com/questions/12976036/how-to-use-usedynlib-correctly-in-an-r-package-namespace-file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130305/fb4b2611/attachment.html>


More information about the Rcpp-devel mailing list