Hi Ramon, On 19 June 2015 at 12:01, Ramon Diaz-Uriarte wrote: | Some of my packages use | | SystemRequirements: C++11 | | in the DESCRIPTION. But then .R/Makevars seems to be ignored (e.g., flags | such as -Wall or using clang) in all that concerns C++ (only CXX and | CXXFLAGS are ignored, not CC or CFLAGS). So I keep commenting that line for | normal development and uncommenting it for final checking before release. | | | I vaguely remember reading somewhere this is the way things work, but this | is not what I understand from reading again | http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Using-C_002b_002b11-code. | | After googling I have not been able to locate anything, and since I guess | it is probably common to use both C++11 and a custom .R/Makevars I think | something is wrong somewhere in my setup. But I have no idea what. I am | using Debian (a mix of testing and unstable), both with stock Debian R and | with custom built Rs.
I settled pretty early on declaring this in src/Makevars only, partly for historical reason (as it is where we always set compiler flags) and partly because I found it to be consistent and reliabel. Writing R Extensions offers an alternate, I forget the details. One tricky bit is that we now have several CXX* variables. And because "code is documentation" I often do the following to remind myself of CXX1X: edd@max:~$ grep ^CXX /etc/R/Makeconf CXX = g++ CXXCPP = $(CXX) -E CXXFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g $(LTO) CXXPICFLAGS = -fpic CXX1X = g++ CXX1XFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g CXX1XPICFLAGS = -fpic CXX1XSTD = -std=c++11 edd@max:~$ I my most recent C++11-only package I did edd@max:~$ cat git/rcpptoml/src/Makevars ## This is a C++11 package CXX_STD = CXX11 ## We need the header in inst/include, and a define PKG_CPPFLAGS = -I../inst/include/ -DCPPTOML_USE_MAP edd@max:~$ which regroups both the the compiler choice, an include directive and a #define in one place. Hope this helps, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel