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,9 +456,18 @@ 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 () {
461- if (getRversion() > = " 3.1" ) # with recent R versions, R can decide
468+ if (getRversion() > = " 3.4" ) # with recent R versions, R can decide
469+ list (env = list (USE_CXX11 = " yes" ))
470+ else if (getRversion() > = " 3.1" ) # with recent R versions, R can decide
462471 list (env = list (USE_CXX1X = " yes" ))
463472 else if (.Platform $ OS.type == " windows" )
464473 list (env = list (PKG_CXXFLAGS = " -std=c++0x" ))
@@ -475,7 +484,10 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
475484# # this is the default in g++-6.1 and later
476485# # per https://gcc.gnu.org/projects/cxx-status.html#cxx14
477486.plugins [[" cpp14" ]] <- function () {
478- 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" ))
479491}
480492
481493# built-in C++1y plugin for C++14 and C++17 standard under development
@@ -485,7 +497,10 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
485497
486498# built-in C++17 plugin for C++17 standard (g++-6 or later)
487499.plugins [[" cpp17" ]] <- function () {
488- 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" ))
489504}
490505
491506# # built-in C++1z plugin for C++17 standard under development
0 commit comments