I am new to building R packages so I need some help :) I am using Rcpp/arrayfire and want a line in my makevars file to detect the users R version. Currently I have it set in 4.0, but I anticipate users having different R versions.
If this question has been answered, I apologize for not finding one!
Here are my global variables in the makevars file
R_VERSION = 4.0
AF_CXXFLAGS = -I/opt/arrayfire/include
AF_LIBS = -L/opt/arrayfire/lib -laf -Wl,-rpath,/opt/arrayfire/lib /Library/Frameworks/R.framework/Versions/$(R_VERSION)/Resources/library/RcppArrayFire/libs/RcppArrayFire.so -Wl,-rpath,/Library/Frameworks/R.framework/Versions/$(R_VERSION)/Resources/library/RcppArrayFire/libs
The usual workflow is to use a script called
configure(which can be written in any language) which 'detects this' and then writes or alterssrc/Makevarsaccordingly.If you know a little about
makeor want to learn it you can also do in aMakefile-- and our scriptsrc/Makevarsis one. So something like this saved in a fileMakefileresults in
Edit And if you wanted just "4.2" out of the version, one way might be
Edit 2 As a full Makefile it becomes