11
2- # Copyright (C) 2012 - 2016 JJ Allaire, Dirk Eddelbuettel and Romain Francois
2+ # Copyright (C) 2012 - 2017 JJ Allaire, Dirk Eddelbuettel and Romain Francois
33#
44# This file is part of Rcpp.
55#
@@ -456,7 +456,14 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
456456# setup plugins environment
457457.plugins <- new.env()
458458
459- # built-in C++11 plugin
459+ # built-in C++98 plugin
460+ .plugins [[" cpp98" ]] <- function () {
461+ if (getRversion() > = " 3.4" ) # with recent R versions, R can decide
462+ list (env = list (USE_CXX98 = " yes" ))
463+ else
464+ list (env = list (PKG_CXXFLAGS = " -std=c++98" ))
465+ }
466+ # built-in C++11 plugin
460467.plugins [[" cpp11" ]] <- function () {
461468 if (getRversion() > = " 3.4" ) # with recent R versions, R can decide
462469 list (env = list (USE_CXX11 = " yes" ))
@@ -477,7 +484,10 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
477484# # this is the default in g++-6.1 and later
478485# # per https://gcc.gnu.org/projects/cxx-status.html#cxx14
479486.plugins [[" cpp14" ]] <- function () {
480- list (env = list (PKG_CXXFLAGS = " -std=c++14" ))
487+ if (getRversion() > = " 3.4" ) # with recent R versions, R can decide
488+ list (env = list (USE_CXX14 = " yes" ))
489+ else
490+ list (env = list (PKG_CXXFLAGS = " -std=c++14" ))
481491}
482492
483493# built-in C++1y plugin for C++14 and C++17 standard under development
@@ -487,7 +497,10 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
487497
488498# built-in C++17 plugin for C++17 standard (g++-6 or later)
489499.plugins [[" cpp17" ]] <- function () {
490- list (env = list (PKG_CXXFLAGS = " -std=c++17" ))
500+ if (getRversion() > = " 3.4" ) # with recent R versions, R can decide
501+ list (env = list (USE_CXX17 = " yes" ))
502+ else
503+ list (env = list (PKG_CXXFLAGS = " -std=c++17" ))
491504}
492505
493506# # built-in C++1z plugin for C++17 standard under development
0 commit comments