[Rcpp-devel] Specify Rcpp header location in Makevars
On 29 July 2015 at 17:19, jsmith5889 at yahoo.com wrote:
| Is there a way to automatically specify the location of the Rcpp include | directory (for Rcpp.h) in Makevars? As Romain said, add "LinkingTo: Rcpp" to your DESCRIPTION. | In my Makevars, I use the following compile command: | | %.o: %.cpp $(cpp_sources) | $(CXX) $(PKG_CXXFLAGS) $< This is generally not a good idea. The advise in "Writing R Extensions" is not as clear-cut on this as it might be but there were e.g. some comments by Simon on this list (or maybe r-devel). In general, you want your Makevars to be as minimal as possibly as these implicit rules __already__ come in via the core Makefile parts provided by R. You are more likely to do harm than good here (and yes, I got burned too in the past). | I also specified "Imports: Rcpp" in DESCRIPTION, but it does not appear | to automatically add the right flags to the compile command. | | I am looking for something that could work similarly to Rscript -e | "Rcpp:::LdFlags()", which used to export the Rcpp library flags. | | Any ideas are greatly appreciated! The best best may be to start with Rcpp.package.skeleton() and see what it creates. Cheers, Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org