Skip to content

Commit 8cfd4a5

Browse files
authored
Merge 7c55d5d into 9878dda
2 parents 9878dda + 7c55d5d commit 8cfd4a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/utils.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,18 +783,22 @@ check_sundials_fpic <- function(verbose) {
783783
rcpp_source_stan <- function(code, env, verbose = FALSE, ...) {
784784
check_sundials_fpic(verbose)
785785
cxxflags <- get_cmdstan_flags("CXXFLAGS")
786+
cppflags <- get_cmdstan_flags("CPPFLAGS")
786787
cmdstanr_includes <- system.file("include", package = "cmdstanr", mustWork = TRUE)
787788
cmdstanr_includes <- paste0(" -I\"", cmdstanr_includes,"\"")
788789
libs <- c("LDLIBS", "LIBSUNDIALS", "TBB_TARGETS", "LDFLAGS_TBB", "SUNDIALS_TARGETS")
789790
libs <- paste(sapply(libs, get_cmdstan_flags), collapse = " ")
790791
if (.Platform$OS.type == "windows") {
791792
libs <- paste(libs, "-fopenmp")
792793
}
794+
if (cmdstan_version() <= "2.30.1") {
795+
cppflags <- paste0(cppflags, " -DCMDSTAN_JSON")
796+
}
793797
withr::with_path(repair_path(file.path(cmdstan_path(),"stan/lib/stan_math/lib/tbb")),
794798
withr::with_makevars(
795799
c(
796800
USE_CXX14 = 1,
797-
PKG_CPPFLAGS = ifelse(cmdstan_version() <= "2.30.1", "-DCMDSTAN_JSON", ""),
801+
PKG_CPPFLAGS = cppflags,
798802
PKG_CXXFLAGS = paste0(cxxflags, cmdstanr_includes, collapse = " "),
799803
PKG_LIBS = libs
800804
),

0 commit comments

Comments
 (0)