Skip to content

Commit efa937d

Browse files
committed
Fix FindR when running under CMD Check
skip-checks: true # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Feb 26 12:33:49 2025 -0500 # # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: cmake/FindR.cmake #
1 parent 49749b4 commit efa937d

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

cmake/FindR.cmake

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,9 @@ set(TEMP_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
3535
set(CMAKE_FIND_APPBUNDLE "NEVER")
3636

3737
# Find R.
38-
find_program(R_EXECUTABLE R DOC "R executable.")
38+
find_program(R_EXECUTABLE R DOC "R executable." PATHS ${R_RHOME} PATH_SUFFIXES bin)
3939

4040
if(R_EXECUTABLE)
41-
# Get the location of R.
42-
execute_process(
43-
WORKING_DIRECTORY .
44-
COMMAND ${R_EXECUTABLE} RHOME
45-
OUTPUT_VARIABLE R_BASE_DIR
46-
OUTPUT_STRIP_TRAILING_WHITESPACE
47-
)
48-
4941
# Get the R version.
5042
execute_process(
5143
COMMAND ${R_EXECUTABLE} --version
@@ -59,14 +51,12 @@ if(R_EXECUTABLE)
5951
R_VERSION_STRING "${R_VERSION_STRING}")
6052
endif()
6153

62-
63-
set(R_HOME ${R_BASE_DIR} CACHE PATH "R home directory obtained from R RHOME")
54+
set(R_HOME ${R_RHOME} CACHE PATH "R home directory obtained from R RHOME")
6455
mark_as_advanced(R_HOME)
6556
endif()
6657

6758
# Find the Rscript program.
6859
find_program(RSCRIPT_EXECUTABLE Rscript DOC "Rscript executable." HINTS "${R_HOME}/bin")
69-
7060
set(CMAKE_FIND_APPBUNDLE ${TEMP_CMAKE_FIND_APPBUNDLE})
7161

7262
# Search for non-standard R.h include path if header missing

0 commit comments

Comments
 (0)