I'm compiling a project that uses some precompiled library (I'm trying to integrate
R C++ code (see http://www.r-project.org/) in a common C++ project). In order to
compile that library it is required to pass to the g++ linker some options (flags?).
The options (flags) may vary from system to system, so one must call a script (or program)
that replies with the right/specific flags for each system.
I do that writing in (right click on the project name) -> Settings -> Linker -> Options the
following:
Code: Select all
`usr/lib64/R/bin/Rscript -e "Rcpp:::LdFlags()"`
Code: Select all
$ /usr/lib64/R/bin/Rscript -e "Rcpp:::LdFlags()"
Code: Select all
-L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib
case the path is:
Code: Select all
/usr/lib64/R/bin/
from it, the "first part":
Code: Select all
/usr/lib64/R/
is exported to the system PATH (when R is installed) trough the following command:
Code: Select all
$ R RHOME
Code: Select all
/usr/lib64/R
that I pass to the compiler. I have tried two things. One is to change:
Code: Select all
`usr/lib64/R/bin/Rscript -e "Rcpp:::LdFlags()"`
Code: Select all
`$(R RHOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
by means of exporting what R RHOME returns. That is, in:
(right click on project name) -> Settings -> PreBuild
I add the follwong command line to run in the pre-build event:
Code: Select all
export R_HOME=$(R RHOME)
Code: Select all
`usr/lib64/R/bin/Rscript -e "Rcpp:::LdFlags()"`
Code: Select all
`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
Which is the right way of do that?
Best Regards