@@ -127,17 +127,24 @@ sourceCpp <- function(file = "",
127127 file.remove(context $ previousDynlibPath )
128128 } # #nocov end
129129
130+ # grab components we need to build command
131+ r <- paste(R.home(" bin" ), " R" , sep = .Platform $ file.sep )
132+ lib <- context $ dynlibFilename
133+ deps <- context $ cppDependencySourcePaths
134+ src <- context $ cppSourceFilename
135+
130136 # prepare the command (output if we are in showOutput mode)
131- cmd <- paste(R.home(component = " bin" ), .Platform $ file.sep , " R " ,
132- " CMD SHLIB " ,
133- ifelse(windowsDebugDLL , " -d " , " " ),
134- " -o " , shQuote(context $ dynlibFilename ), " " ,
135- ifelse(rebuild , " --preclean " , " " ),
136- ifelse(dryRun , " --dry-run " , " " ),
137- paste(shQuote(context $ cppDependencySourcePaths ),
138- collapse = " " ), " " ,
139- shQuote(context $ cppSourceFilename ), " " ,
140- sep = " " )
137+ cmd <- paste(
138+ r , " CMD" , " SHLIB" ,
139+ if (windowsDebugDLL ) " -d" ,
140+ if (rebuild ) " --preclean" ,
141+ if (dryRun ) " --dry-run" ,
142+ " -o" , shQuote(lib ),
143+ if (length(deps ))
144+ paste(shQuote(deps ), collapse = " " ),
145+ shQuote(src )
146+ )
147+
141148 if (showOutput )
142149 cat(cmd , " \n " ) # #nocov
143150
0 commit comments