r-lib / pkgbuild

Find tools needed to build R packages
https://pkgbuild.r-lib.org
Other
66 stars 35 forks source link

Compiler flags for for C++14 #112

Closed const-ae closed 2 years ago

const-ae commented 3 years ago

Hi,

I am maintaining a package that depends on C++14 features. I tried to compile the package with debug flags, but noticed that pkgbuild::with_debug(devtools::load_all()) had no effect on the optimization level. After some digging, I found that withr::with_makevars(c(CXX14FLAGS = "-Wall -g -O0", devtools::load_all()) has the desired behavior.

As far as I can see, the problem comes from the fact that pkgbuild defines the compiler flags only for C++11.

Would it be possible to add a line for C++14 (and newer versions)?

Best Regards, Constantin

jimhester commented 3 years ago

Sure, do you want to write a pull request to add the flags for C++14, C++17 and C++20?

const-ae commented 3 years ago

The pull request is at https://github.com/r-lib/pkgbuild/pull/113

gaborcsardi commented 2 years ago

This was fixed in #113.