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.