Giorgio Spedicato
Giorgio Spedicato

Reputation: 2503

Rcpp Makevars related warning

I am the mantainer of few R packages that use Rcpp for some core calculations. Wishing to try a new feature of the Rcpp package as described in Rcpp 0.12.18 Rbloggers

To do so I did the following:

  1. I created a Makevars and Makevars.win in my scr folder, both contaning the line CPPFLAGS += -DRCPP_USE_UNWIND_PROTECT
  2. I added the SystemRequirements: GNU make entry in the DESCRIPTION file.

Btw that raises some issues that I wounder will make my package rejected on CRAN:

  1. following Warning message in compiling my package:
    • checking compilation flags in Makevars ... WARNING Variables overriding user/site settings: CPPFLAGS: -o /dev/null -DRCPP_USE_UNWIND_PROTECT
  2. Note: GNU make is a system requirement

I would like to know if it is possible to rewrite the Makevars to remove the warning and possibly, the Gnu make requirement

Thanks in advance for the attention

Upvotes: 0

Views: 270

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368261

You want to use PKG_CPPFLAGS (or PKG_CXXFLAGS) as that is the per-package variant. What you altered is the system-wide version hence the warning.

More details are as always in the Writing R Extensions manual, otherwise the many existing example packages (all on CRAN and browseable at GitHub) can help too.

For example, here is the one-toggle-setting use case from the RcppExamples package:

PKG_CXXFLAGS = -DRCPP_NEW_DATE_DATETIME_VECTORS

(which is strictly-speaking no longer needed as the "new" Date and Datetime vector classes became the default a while ago).

Also, if you use this form you do not need the += and have no requirement to declare on GNU make -- another win.

Upvotes: 2

Related Questions