1

I have a package and each time I make an update to the CRAN I check it with g++-7, g++-8, clang++ and so on according to the different compilers used on CRAN.

My Makevars(.win) is the following

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -I../inst/include/
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
CXX_STD = CXX11

To change the compiler I change .R/Makevars like so:

CXX = clang++

However .R/Makevar is respected only if I removed the CXX_STD flag in the package Makevars. Otherwise the default applies and it compiles with g++ (7.4.0 on my computer) and -std=gnu++11.

I would like to know if there is a better/good workflow to compile and test my package with several compilers and without modifying the package Makevars.

I'm running a Linux system, and I compile with the button Clean and rebuild from Rstudio.

JRR
  • 3,024
  • 2
  • 13
  • 37
  • 1
    Does this answer your question? [Understanding the contents of the Makevars file in R (macros, variables, ~/.R/Makevars and pkg/src/Makevars)](https://stackoverflow.com/questions/43597632/understanding-the-contents-of-the-makevars-file-in-r-macros-variables-r-ma). There are also `CXX11` etc., which van be changed in `~/.R/Makevars`. – Ralf Stubner Dec 10 '19 at 20:52
  • This indeed answer my question. I understand that the use of `CXX11` in `~/.R/Makevars` goes with the use of `CXX11` in `src/Makevars`. Thank you. – JRR Dec 10 '19 at 21:52

0 Answers0